Solved QSql fetching smaller data set
-
Hi,
I was checking a SQL->Qt link and found that the number of records fetched was lower than the number of tuples present in the SQL DB.Code:
SQL Queryselect * from [Table Name] where TxTimestamp=0.08249259
The number of tuples in table is 256, while the code :
queryResult.exec(QString("select * from [TABLE NAME] where TxTimestamp="0.08249259")); int noOfRecords = queryResult.record().count();
noOfRecords = 21.
What might the problem I am facing?
EDIT:
Using:
while(queryResult.next()) { }
to traverse the result iterates through all 256 inputs
-
@Ankit.Jain Use http://doc.qt.io/qt-5/qsqlquery.html#size
QSqlRecord returned by record() is something different, see http://doc.qt.io/qt-5/qsqlquery.html#record
http://doc.qt.io/qt-5/qsqlrecord.html#count "Returns the number of fields in the record."