[Gambas-user] Use of db.Begin, db.Commit and db.Rollback with a datasource and datacontrols

Martin McGlensey mmcg29440 at ...3163...
Tue Jan 20 01:11:50 CET 2015


Hello,

 

I have a form containing a datasource linked to a MySQL database table. The
datasource contains datacontrols to display the data from the underlying
table. There are buttons for add, edit, save, delete and cancel. The add
button creates a new record. The save button saves the record. The Edit
button allows change to the record. The cancel button cancels the changes.
The delete button deletes the entire record.

 

I would like the cancel button to cancel the add and all edits and
repopulate the form with the original data from the datasource table. If the
user hits the cancel button no change should be made to the table. The
delete button asks for confirmation before deleting the record.

 

I'm not so much looking for code so much but for advice on the proper
sequence of bd.begin etc. Should add and edit begin a transaction and save
commit the transaction? Should cancel rollback the transaction? The syntax
is $Con.Begin, $Con.Commit and $Con.Rollback. Is that correct? If my thought
is correct how do I get the form to display the original data?

 

Thanks




More information about the User mailing list