[Qt-interest] mqsql query terminating at 100th result

Robert Wood robert.wood at apostrophe.co.uk
Mon Feb 1 20:09:24 CET 2010


It would appear that it's something to do with the * in the SELECT FROM.

If I change the sql string to:

queryString = "SELECT ref_des FROM " + ui->tablesComboBox->currentText();

...and choose my partslist_table, I get all 1066 results from the sql 
table populated in my Qt table.

Wonder whether it's a bug.

> Hi Andreas,
> 
> Hopefully I understand the question correctly (I've put the code in 
> below again for clarity):
> 
> I am calling that routine when a button is pressed. A combo box has 
> selected the particular table name, so if I set a breakpoint at the line:
> 
> pos = query.at();
> 
> I hit that line 99 times, the variable "line" counts up to 99 (pos is 
> actually at 98). If I then single step through the code I hit the 
> while(query.next()) code and it drops out of the while loop.
> 
> The breakpoint is set before I start the program, so the while loop ,ust 
> be only called once.
> 
> Cheers,
> 
> Rob
> 
> 
>         queryString = "SELECT * FROM " + ui->tablesComboBox->currentText();
>         query.exec(queryString);
>         rows = query.size();
> 
>         line = 0;
>         while(query.next())
>                 {
>                 pos = query.at();
>                 ui->tableWidget->insertRow(pos);
>                 queryString = "";
>                 for (j=0;j<columns;j++)
>                         {
>                         queryString = query.value(j).toString();
>                         QTableWidgetItem *qTItem = new QTableWidgetItem;
>                         qTItem->setText(queryString);
>                         ui->tableWidget->setItem(line,j,qTItem);
>                         }
>                 line++;
>                 }
> 
> 
> 
> 
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
> 



More information about the Qt-interest-old mailing list