Why this code is not working?
db
= QSqlDatabase::addDatabase("QSQLITE");
//I defined the "db" at header. db.setDatabaseName("../database");
db.open();
query.exec("SELECT id FROM lesson");
db = QSqlDatabase::addDatabase("QSQLITE"); //I defined the "db" at header.
db.setDatabaseName("../database");
db.open();
QSqlQuery query(db);
query.exec("SELECT id FROM lesson");
QMessageBox::about(0,"",query.value(0).toString());
To copy to clipboard, switch view to plain text mode
code is running without any error but value which in message box is null. There is no result at query value.
Bookmarks