[Qt-interest] doubt. How could I count the result of a select
Andre Somers
andre at familiesomers.nl
Wed May 26 10:27:02 CEST 2010
On 26-5-2010 10:15, 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!
It depends.
If you do a relatively simple select on a table and the resultset is
big, you could first do a SELECT COUNT() with the same WHERE clause.
That will give you the count. I do that sometimes if I have a *lot* of
data to read and process, and I want to display a progres bar.
Otherwise, do you really need the count of the results before you
actually have the results? Can't you just add to your QTableWidget as
you read the results, and let QTableWidget handle it? Or, perhaps you
can use a QTableView and a QSqlQueryModel and have Qt deal with it all?
André
More information about the Qt-interest-old
mailing list