Database.CommitTransaction

From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!
Method

Database.CommitTransaction()

New in 2019r2

Supported for all project types and targets.

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

Notes

A DatabaseException will be raised if the transaction could not be committed.

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
MessageBox("Error: " + error.Message)
DB.RollbackTransaction
End Try

See Also

Database.Close, Database.RollbackTransaction