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] QSqlTableModel refuses to write data in database
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] QSqlTableModel refuses to write data in database

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.5k Views 1 Watching
  • 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.
  • S Offline
    S Offline
    soroush
    wrote on last edited by
    #1

    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:
    @
    if(Database::instance.open())
    {
    model = new QSqlTableModel (this,Database::instance);
    model->setTable("myTable");
    tableView->setModel(model);
    mapper = new QDataWidgetMapper(this);
    //...
    }
    @

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lgeyer
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • S Offline
        S Offline
        soroush
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • S Offline
          S Offline
          soroush
          wrote on last edited by
          #4

          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 :-/

          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