QSqlQuery for ms access database
Solved
General and Desktop
-
@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.
21/24