QSqlQuery for ms access database
-
What I am asking for is an example without binding that is working. Once we have that it should be easier to come with a solution.
-
What I am asking for is an example without binding that is working. Once we have that it should be easier to come with a solution.
wrote on 1 Sept 2019, 10:23 last edited by@sgaist
I have no idea. -
wrote on 1 Sept 2019, 19:23 last edited by
Hi, the use of % instead of * is the right way. The * is only for using it directly on ms access query.
WHat version of ms access are you using? could you post a screenshot of your database/table?
-
Hi, the use of % instead of * is the right way. The * is only for using it directly on ms access query.
WHat version of ms access are you using? could you post a screenshot of your database/table?
wrote on 2 Sept 2019, 04:10 last edited by behruz montazeri 9 Feb 2019, 04:44@ronaldviscarral
Thanks for your response here is my screenshot :
link imaget -
Hi, the use of % instead of * is the right way. The * is only for using it directly on ms access query.
WHat version of ms access are you using? could you post a screenshot of your database/table?
wrote on 2 Sept 2019, 04:40 last edited by behruz montazeri 9 Feb 2019, 04:41This post is deleted! -
@sgaist
I have no idea.@behruz-montazeri said in QSqlQuery for ms access database:
@sgaist
I have no idea.Something like
"SELECT * FROM names where name like '%foo%'"
to confirm that one is working properly. -
@behruz-montazeri said in QSqlQuery for ms access database:
@sgaist
I have no idea.Something like
"SELECT * FROM names where name like '%foo%'"
to confirm that one is working properly.wrote on 2 Sept 2019, 07:03 last edited by behruz montazeri 9 Feb 2019, 10:05@sgaist
Yes that works.Then what should be inside the % % instead of foo for binding ???
what about binding ?? -
wrote on 2 Sept 2019, 19:28 last edited by
try this:
QSqlQuery query ; query.prepare("SELECT * FROM names where name like '%?%'" ); query.addBindValue("a");
-
wrote on 2 Sept 2019, 20:15 last edited by
I tested in Qt using access both 32 bits, this code works for me:
QString st = "a"; query->prepare("SELECT * FROM names WHERE name LIKE ?;"); QString criteria("%" + st + "%"); query->addBindValue(criteria);
-
I tested in Qt using access both 32 bits, this code works for me:
QString st = "a"; query->prepare("SELECT * FROM names WHERE name LIKE ?;"); QString criteria("%" + st + "%"); query->addBindValue(criteria);
wrote on 3 Sept 2019, 03:56 last edited by@ronaldviscarral
Thank you very much it works now.
24/24