c++ - How to get total number of rows/records in an sqlite table -


i want know how total number of rows/records in sqlite table , assign variable. did this;

    qsqlquery query("select count(*) class1_bills"); 

but problem is, how assign result variable? tried;

int rows = query.seek(0); 

and;

int rows = query.value(0).toint(); 

yes, know doing accesses record @ field position 0 in table. seems qt's query methods accessing particular records @ field positions only. if i'm wrong please correct me. how total row count in table?

the query returns single column , single row.

just read value:

query.first(); count = query.value(0).toint(); 

Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -