Important: Please read the Qt Code of Conduct -

[SOLVED] QSqlTableModel refuses to write data in database

  • I do write a a couple of applications similar to this one. All of them work, but this doesn't work properly! The problem is that QSqlTableModel can't change content of table in database. When I select a row and edit a cell, then apply query again, anything is not changed.
    This is connection method:
    model = new QSqlTableModel (this,Database::instance);
    mapper = new QDataWidgetMapper(this);

  • What is your editStrategy?
    Did you submitAll() when using QSqlTableModel::OnManualSubmit?
    What does lastError() return?

  • Edit strategy is OnRowChange.

    Returned error is :
    Using unsupported buffer type: 86026 (parameter: 1) QMYSQL3: Unable to bind value

    I'm using MySQL version 5.5.23

  • I replaced libmysql.dll which I compiled QMYSQL driver against it, with the newer version that I just installed on client's machine. Works fine.

    Thanks for your response.

    Note: programming for Windows using Qt makes me mad :-/

Log in to reply