My QT SQL select doesn't return any data:
//connect DB
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName("C:/temp/atsakymai_1.db");
if (!db.open())
{
qDebug() << "Connection error!!!";
}
QSqlQuery query;
query.prepare("SELECT * FROM transportas");
if (!query.exec())
{
qDebug() << "SQL error: "<< query.lastError().text() << endl;
}
qDebug() << query.executedQuery();
qDebug() << query.result();
qDebug() << query.size();
query.first();
while (query.next())
{
qDebug() << "found " << endl;
}
Tryed to write path like this - C:\temp\atsakymai_1.db, but result the same: qurey.result - 0x3c6ed8 query.size - -1
I had google all day to find any soliution, but it didn't help, still have no idea what is wrong with my code.
Aucun commentaire:
Enregistrer un commentaire