hello,
i'm able to connect with db[MySql].
i'm trying to Execute the Sql Query but i'm not getting wrong result.
I want to get the number of row in the current table.
My Query is :
QSqlQuery q1
("SELECT COUNT(RecordId) FROM tbl;");
QString Str
= q1.
value(0).
toString();
QSqlQuery q1("SELECT COUNT(RecordId) FROM tbl;");
QSqlRecord rec1 = q1.record();
QString Str = q1.value(0).toString();
QMessageBox::information(this, tr("Count"),Str);
To copy to clipboard, switch view to plain text mode
The result in message box is NULL.
if we run the sql query normally we get the result i.e 10;
What wrong in the query.
Bookmarks