开发者

Qt and SQlite Database, How do i count queries?

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
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜