mcwar
11th January 2010, 14:30
Why this code is not working?
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());
code is running without any error but value which in message box is null. There is no result at query value.
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());
code is running without any error but value which in message box is null. There is no result at query value.