Hi,
I use QSqlTableModel to access table stored in database,when I traverse and handle every row in one table which contains about 3500 rows, i find it need 3-4 seconds that is too slow. Is it normal and how to improve it?
here is my code,
int GetRecordCount()ï½›
while(sqlTableModel.canFetchMore())
ï½›
sqlTableModel.fetchMore();
ï½
return sqlTableModel.rowCount();
ï½
//traverse table
for (i=0 ï¼›i<=GetRecordCount()ï¼›i++)
ï½›
//...
//...
ï½
int GetRecordCount()ï½›
while(sqlTableModel.canFetchMore())
ï½›
sqlTableModel.fetchMore();
ï½
return sqlTableModel.rowCount();
ï½
//traverse table
for (i=0 ï¼›i<=GetRecordCount()ï¼›i++)
ï½›
QSqlRecord record = sqlTableModel.record(i);
//...
//...
ï½
To copy to clipboard, switch view to plain text mode
Bookmarks