UPDATING comboBox of QTableWidget using SQLite3 Datbase???



  • Hi,
    I used following code to update sqlite3 database for ComboBox which is a widget in QTableWidget but its not getting updated.
    QString r (QString("UPDATE cockpit SET Status = '%1'").arg(lis.at(0)));
    qDebug() << lis.at(0);
    qr.prepare(r);
    if( !qr.exec() )
    qDebug() << qr.lastError();
    else
    qDebug( "Updated!" ); / here it executes and displays as Updated!

    But when close GUI and and run for the next time the updated value is lost....it still shows the precious value....
    i have used following lines to check the updated status column..
    qry.prepare("SELECT Status FROM cockpit");
    if( !qry.exec() )
    qDebug() << qry.lastError();
    else {
    // QComboBox *combos;

                   for( int r = 0; r < 9; r++ )   {
                          QComboBox *combos = qobject_cast<QComboBox*>(ui->tableWidget->cellWidget(r,1));
                              qDebug() << combos->currentText();
                          }
    
            }
    

    Any help is appreciated....


  • Moderators

    I cannot see where you put the values from SELECT query in your comboboxes


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.