Hi Parvinder,
I think the trouble is where you're using the 'session.find' method.
http://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1Dbo_1_1Session.html#a637d1031ffddd4bd7bbb55a616192ac7
It seems to want just the 'where' clause instead of the whole select
statement. It gets the table name and columns from the model class itself.
instead of:
colform collect = session_.find<form>("select * from test1
where store like '%$nameEdit_%'");
maybe try:
typedef Wt::Dbo::collection<
Wt::Dbo::ptr<form><http://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1Dbo_1_1collection.html>>
Forms;
Forms collect = session_.find<form>("store like
'%?%'").bind(nameEdit_->value());
I think that should get you moving in the right direction.
Kind Regards,
Matthew Sherborne
On Tue, Nov 1, 2011 at 2:44 AM, PARVINDER RAJPUT <[email protected]> wrote:
> Hello All
> Any one please guide me. How to use search query used in Wt
> Application. I have written the following code.
>
>
> void WtApplication::hello()
> {
> root()->addWidget(new WText("Search")); // show some text
> nameEdit_ = new WLineEdit(root());
> root()->addWidget(new WBreak());
>
> WPushButton *b = new WPushButton("Find", root()); // create a button
> b->setMargin(10, Left); // add 5 pixels
> margin
> // insert a line break
> greeting_ = new WText( root()); // empty text
> b->clicked().connect(this, &WtApplication::populate);
>
> }
>
>
>
> void WtApplication::populate() { //fetching
>
>
> msg("<center><H1></H1></center>","<center><H1></H1></center>","<center><H1></H1></center>","<center><H1></H1></center>","<center><H1></H1></center>");
>
> try {
> greeting_->setText( nameEdit_->text());
>
> Transaction tt(session_);
> colform collect = session_.find<form>("select *
> from test1
> where store like '%$nameEdit_%'");
> for (colform::const_iterator i =
> collect.begin(); i != collect.end(); ++i)
>
>
>
>
> msg((*i)->store,(*i)->name,(*i)->contact,(*i)->intercom,(*i)->stream);
> tt.commit();
> } catch (...) {}
>
> }
>
> Thanks in Advance
> --
> Parvinder Rajput
> website:- www.parvinder.co.in
>
>
> ------------------------------------------------------------------------------
> Get your Android app more play: Bring it to the BlackBerry PlayBook
> in minutes. BlackBerry App World™ now supports Android™ Apps
> for the BlackBerry® PlayBook™. Discover just how easy and simple
> it is! http://p.sf.net/sfu/android-dev2dev
> _______________________________________________
> witty-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
------------------------------------------------------------------------------
RSA® Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest