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 :

Qt Code:
  1. QSqlQuery q1("SELECT COUNT(RecordId) FROM tbl;");
  2. QSqlRecord rec1 = q1.record();
  3. QString Str = q1.value(0).toString();
  4. 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.