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 query 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
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With