Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved]Can't save to changes to mysql.
QtWS25 Last Chance

[Solved]Can't save to changes to mysql.

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 623 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Komerad
    wrote on last edited by
    #1

    I can load the table fine. But when I change a value and sort a column or refresh the table the chance is not applied.

    Main (no problems here)
    @
    db = QSqlDatabase::addDatabase("QMYSQL");
    ..
    db.open();
    model=new QSqlTableModel(this);
    model->setTable("movieview");
    model->setEditStrategy(QSqlTableModel::OnManualSubmit);
    loadDB();@

    @void MainWindow::on_Connectsql_button_clicked()
    {
    model->submitAll(); // <- should write model back to database no?
    loadDB();
    }

    void MainWindow::loadDB(){
    QString debugg = model->lastError().text();
    qDebug() << debugg;
    qDebug() << QSqlDatabase::drivers();
    model->select();

    ui->tableView->setModel(model);
    
    for ( int i = 0; i <= 1; i++)
    {ui->tableView->hideColumn(i);}
    for ( int i = 3; i <= 25; i++)
    {ui->tableView->hideColumn(i);}
    for ( int i = 28; i <= 29; i++)
    {ui->tableView->hideColumn(i);}
    

    }@

    Debug output on click button :

    bq. " "
    ("QSQLITE", "QMYSQL", "QMYSQL3", "QODBC", "QODBC3", "QPSQL", "QPSQL7")
    "Using unsupported buffer type: 380399704 (parameter: 3) QMYSQL3: Unable to bind value"

    The buffer error occurs when i changed a cell and clicked the button.

    Not sure why it shows qmysql3.
    Any guidance in this would be appreciated.

    No clue where the libmysql.dll from 2006 came from. replaced by the one from the mysql lib folder.
    Works now.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved