I've tried a lot of things.
query.isNull()
tried the query.Record()
then int col = query.Record()
if I put query.size()
it will return -1 even if the query has result.
How do i count queries in SQLite?
I wanted to do this:-
if(the qu开发者_开发技巧ery returns null or empty)
{
do this;
}
else
{
do that;
}
query.size() does not work with the SQlite database driver in Qt. You can do:
query.exec();
bool gotResults = false;
while (query.next()) {
gotResults = true;
// do something with the result using query.value(...)
}
if (!gotResults) {
// do something else
}
精彩评论