Solved Qtime return time in sqlite
-
Hello all
I'm using sqlite in my table i add a field for time , and give it intger typeQDateTime now = QDateTime::currentDateTime(); QSqlQuery query("SELECT * FROM [main].[items]"); qDebug() << query.value(3).toInt(); qDebug() << query.lastError(); qDebug() << now.date();
the ouput of value3 is
QSqlQuery::value: not positioned on a valid record 0 QSqlError("", "", "") QDate("2016-10-14")
0
-
Hi,
Because you haven't called next after your query ran. See the examples in QSqlQuery documentation details.