I am trying to use QSqlite in my QT project.
according to the QT assistant, I use the QSqlquery to insert data into database, but failed!!
Here's my code:
QSqlQuery insert(db);
insert.exec("select * from Person");
int num = insert.size();
if( !insert.isActive())
QMessageBox::information(this, "Query not activited", "Sorry but this query is not activited!");
bool ok = insert.exec( QString("insert into Person values (%1, \'%2\', \'%3\', %4)").arg(num + 1).arg(name).arg(sex).arg(age));
Plz tell me how to make it if anybody know it.
Thanks!!
Bookmarks