Try with this:
if (!insert.exec("select * from Person"))
QMessageBox::critical(0,
"Error", insert.
lastError().
text());
else
QMessageBox::information(0,
"Successfull",
QString("Query successfully with %1 rows affected").
arg( insert.
numRowsAffected() ));
QSqlQuery insert(db);
if (!insert.exec("select * from Person"))
QMessageBox::critical(0, "Error", insert.lastError().text());
else
QMessageBox::information(0, "Successfull", QString("Query successfully with %1 rows affected").arg( insert.numRowsAffected() ));
To copy to clipboard, switch view to plain text mode
With this code you can see the error or the number of rows affected by query.
Bookmarks