Results 1 to 3 of 3

Thread: Adding several records to the QSqlTableModel serially

  1. #1
    Join Date
    Sep 2010
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Adding several records to the QSqlTableModel serially

    I'm trying to add several records to the QSqlTableModel, serially. But when I'm call insertRow method second time without submitting changes, model forgets previous changes. I don't know how many inserts user will make (so I can not call insertRows(n)) and I must have opportunities to roll back changes, so I can't call submit method after each inserting.

  2. #2
    Join Date
    Aug 2009
    Location
    Belgium
    Posts
    310
    Thanks
    10
    Thanked 31 Times in 25 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Adding several records to the QSqlTableModel serially

    Hello,

    That's what transactions are used for. Haven't worked with them myself yet, but I guess it's not so hard.

    Best regards,
    Marc

  3. The following user says thank you to marcvanriet for this useful post:

    lgardster (2nd September 2010)

  4. #3
    Join Date
    Sep 2010
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Adding several records to the QSqlTableModel serially

    Thank you so much. Transactions really helps me to solve my problem.

Similar Threads

  1. Updating QAbstractItemModel with new records
    By psih128 in forum Qt Programming
    Replies: 0
    Last Post: 10th May 2010, 01:02
  2. SQLite - check if any records are returned
    By amicitas in forum Newbie
    Replies: 1
    Last Post: 28th September 2008, 10:28
  3. QTableWidget Sql Query 25.000 records
    By aekilic in forum Qt Programming
    Replies: 2
    Last Post: 12th August 2008, 14:54
  4. Combobox Delegate 25.000 records
    By aekilic in forum Qt Programming
    Replies: 9
    Last Post: 29th July 2008, 12:26
  5. Writing Log Records To A Log File
    By vermarajeev in forum Qt Programming
    Replies: 9
    Last Post: 20th March 2007, 13:08

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.