Database.CommitTransaction

From Xojo Documentation

Revision as of 12:38, 29 March 2021 by PLefebvre (talk | contribs) (Notes: Changed text to refer to BeginTransaction method added in API 2.0)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Method

Database.CommitTransaction()

New in 2019r2

Supported for all project types and targets.

Commits an open transaction. This permanently saves changes to the database.

Exceptions

Exception Reason
DatabaseException Raised if the transaction could not be committed.

Notes

You have to have an open transaction to be able to use CommitTransation. Use BeginTransaction to begin a transaction:

DB.BeginTransaction

Sample Code

You typically want to commit changes after ensuring there were no database errors:

// Prior DB code has run

Try
DB.CommitTransaction
Catch error As DatabaseException
MsgBox("Error: " + error.Message)
DB.RollbackTransaction
End Try

See Also

Database.Close, Database.RollbackTransaction