Database.Close

From Xojo Documentation

Method

Database.Close()

Supported for all project types and targets.

Closes or disconnects the database.

Notes

Calling Close does not issue a Commit, but some databases will automatically Commit changes in a transaction when you Close the connection and some database will automatically Rollback changes in a transaction when the connection is closed. Refer to the documentation for your database to check what its behavior is.

For desktop apps, you will often Connect to the database when the app starts and Close it when the app quits.

For web apps, you usually Connect to the database when the Session starts and Close it when the Session quits.

Sample Code

This code in the App.Close event handler closes a previously connected database:

DB.Close // DB is a property on App