[Qt-interest] doubt. How could I count the result of a select

Sean Harmer sean.harmer at maps-technology.com
Wed May 26 10:31:45 CEST 2010


On Wednesday 26 May 2010 09:15:57 mierdatutis mi wrote:
> Hi,
> 
> I'm using QSqlQuery to do a select of a database but... how could I count
> the result rows of the select. I need it to  draw a QTableWidget whith
> these rows number.
> 
> Many thanks and sorry for my english!

Just use QSqlQueryModel and a QTableView and let Qt do the heavy lifting for 
you:

http://doc.qt.nokia.com/4.7-snapshot/qsqlquerymodel.html#details

If you really do want to do it on your own for some reason then you need 
QsqlQuery::size():

http://doc.qt.nokia.com/4.7-snapshot/qsqlquery.html#size

Cheers,

Sean



More information about the Qt-interest-old mailing list