PDA

View Full Version : Adding several records to the QSqlTableModel serially



lgardster
1st September 2010, 17:17
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.

marcvanriet
1st September 2010, 23:34
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

lgardster
2nd September 2010, 16:34
Thank you so much. Transactions really helps me to solve my problem.