Results 1 to 2 of 2

Thread: QSqlTableModel->submitAll()

  1. #1
    Join Date
    Feb 2006
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QSqlTableModel->submitAll()

    Hey there,
    i have got a problem with updating a Psql-Table. the code gets the results

    QSqlTableModel* modelPerson= new QSqlTableModel(0,QSqlDatabase::database("user"));
    modelPerson->setTable("ST_Person");
    modelPerson->setEditStrategy(QSqlTableModel::OnManualSubmit) ;
    modelPerson->setFilter("\"Person_No\"=48980");
    if (!modelPerson->select())
    {
    QMessageBox::warning(this,"Person, modelPerson",modelPerson->lastError().text());
    return;
    }
    QSqlRecord rec=modelPerson->record(0);
    qDebug()<<"P1"<<modelPerson->record(0).value("Prename").toString();

    rec.setValue(Prename","TEST");
    modelPerson->setRecord(0,rec);

    qDebug()<<"P2"<<modelPerson->record(0).value(Prename").toString();
    bool r=modelPerson->submitAll();
    qDebug()<<"result:"<<modelPerson->lastError().text();
    qDebug()<<"P3"<<modelPerson->record(0).value("Prename").toString();
    modelPerson->select();
    qDebug()<<"P4"<<modelPerson->record(0).value(Prename").toString();

    P1:"startPrename" ;//OK
    P2:"Test";//OK
    r become false!!!
    result:" No Fields to update"
    P3:"Test";//OK
    P4:"startPrename";//OK, because not updatet

    Why does the submitAll() fails?

  2. #2
    Join Date
    Feb 2006
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QSqlTableModel->submitAll()

    switching down the qt version from qt4.41 to qt4.3.5 it works fine => it seems to be a bug in the psqldriver changes

Similar Threads

  1. QSqlTableModel inserts empty rows
    By Nesbitt in forum Qt Programming
    Replies: 2
    Last Post: 6th August 2008, 13:47
  2. Replies: 4
    Last Post: 9th May 2008, 18:02
  3. Subclassing QSqlTableModel to overwrite setQuery
    By montuno in forum Qt Programming
    Replies: 3
    Last Post: 16th November 2007, 11:32
  4. QSqlTableModel
    By raphaelf in forum Qt Programming
    Replies: 4
    Last Post: 4th March 2006, 13:35
  5. QSqlTableModel Help pls
    By munna in forum Newbie
    Replies: 1
    Last Post: 26th January 2006, 08:58

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.