<div class="meta" robots="noindex">

</div>

Method

# Database_Class.Commit

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2019r2. Please use `Database.CommitTransaction<database.committransaction>` as a replacement.

</div>

## Description

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

## Notes

You have to have an open transaction to be able to use <span class="title-ref">Commit</span>. On SQLite (and other databases), you can start a transaction with this command:

``` xojo
BEGIN TRANSACTION
```

It can be sent using SQLExecute:

``` xojo
DB.SQLExecute("BEGIN TRANSACTION")
```

## Sample code

You typically want to <span class="title-ref">Commit</span> changes after ensuring there were no database errors:

``` xojo
' Prior DB code has run

If Not DB.Error Then
  DB.Commit
Else
  MsgBox("Error: " + DB.ErrorMessage)
  DB.Rollback
End If
```

## Compatibility

All project types on all supported operating systems.

## See also

`Database</api/databases/database>` parent class; `Database.Close<database.close>`, `Database.RollbackTransaction<database.rollbacktransaction>`
