View Full Version : Sql select table query error

4th July 2011, 10:58
Hello friends i have a small problem in retrieving data from a sql database. I am able to save data into the table and even retrieve it in other parts of my program. But in this place i am having a sql error .

for(int i=0; i <dbrowcount.count();i++)
deletenum = dbrowcount.at(i);
QSqlQuery sqp("SELECT Box1 FROM tempBulkdb rowid ="+ QString::number(deletenum));
if (sqp.first())
} while(sqp.next());

qDebug()<< sqp.lastError().text();
dbrowcount has the row number and the size of the list. I have 10 nested else if condition i have put only the first condition , i am testing the first condition only now.
i get a sql error. I don't know if i am doing any thing wrong.
This is the Sql Error i am getting.

No query Unable to fetch row

thank you

4th July 2011, 12:03
I think you are missing WHERE in this following query:

QSqlQuery sqp("SELECT Box1 FROM tempBulkdb WHERE rowid ="+ QString::number(deletenum));

4th July 2011, 12:12
hello thank you so much. .. that was exactly the problem. I missed the WHERE clause. It works now.
Thank you