Difference between revisions of "Database.Rollback"
From Xojo Documentation
|Line 1:||Line 1:|
Revision as of 21:37, 20 May 2019
| This item was deprecated in version 2019r2.
Please use Database.RollbackTransaction as a replacement.
Cancels an open transaction restoring the database to the state it was in before the transaction began.
You will generally want to rollback database changes if a database error occurs within the transaction.
You have to have an open transaction to be able to use Rollback. On SQLite (and other databases), you can start a transaction with this command:
It can be sent using SQLExecute:
This code uses rollback to revert database changes in a transaction when an error occurs:
If Not DB.Error Then
MsgBox("Error: " + DB.ErrorMessage)