Results 1 to 20 of 57

Thread: Record update windowd entered data saving

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Update window problem [DESPERATE - NOT SOLVED]

    I have an QSqlTabelModel filled with data from three sql tables. When I press in customer browser button "Insert record" or "Change record", mthe update record window show, which contain several QLineEdit widgets. How do I save entered data into database? My exact question is, how to convert every QLineEdit.text() into corespoding record field and then save it?

    Qt Code:
    1. const int INSERT_RECORD_AT_END=-1;
    2.  
    3. QSqlRecord cDataRecord;
    4.  
    5. cDataRecord.setValue("SIFRA", m_pUpdateWindow->GetCustomerID()->text());
    6. cDataRecord.setValue("DS", m_pUpdateWindow->GetTaxNumber()->text());
    7. cDataRecord.setValue("PRIIMEK", m_pUpdateWindow->GetSurname()->text());
    8. cDataRecord.setValue("IME", m_pUpdateWindow->GetName()->text());
    9. //cDataRecord.setValue("ULICA", m_pUpdateWindow->GetStreetID()->text());
    10. cDataRecord.setValue("STEVILKA_ULICE", m_pUpdateWindow->GetStreetNumber()->text());
    11. cDataRecord.setValue("POSTA_STEVILKA", m_pUpdateWindow->GetZipCode()->text());
    12.  
    13. if(m_pTableModel->insertRecord(INSERT_RECORD_AT_END, cDataRecord))
    14. {
    15. QSqlError error=m_pTableModel->lastError();
    16. if(error.type()!=QSqlError::NoError)
    17. {
    18. qDebug() << m_pTableModel->query().lastQuery();
    19. } // if
    20. } // if
    To copy to clipboard, switch view to plain text mode 
    Is it maybe problem in insertRecord paramaters?
    Last edited by MarkoSan; 9th January 2006 at 19:59.

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.