SQL query not working
Unsolved
General and Desktop
-
Hi
The syntax is not valid i think
a.exec("Select Stock From Manufacturer_stock Where Product='Parle' ");
( add single quotes around text values )If you are using SQLite then
http://sqlitebrowser.org/
Is nice tools as you can test your SQL there and easy work with the database. -
HI
Can u try with this, hope this works for you.
QSqlQuery query; query.prepare("Select Stock From Manufacturer_stock Where Product='Parle'; "); query.exec(); while(query.next()) { QString firstValue = query.value(0).toString(); qDebug() << "first value :" << firstValue << endl; QString secondValue = query.value(1).toString(); qDebug() << "second value :" << secondValue << endl; }
and provide debug statements,
As mentioned by @p3c0 check whether the dB is opened.