SQLiteDatabase.CreateDatabaseFile

From Xojo Documentation

Method

SQLiteDatabase.CreateDatabaseFile()

Supported for all project types and targets.

Creates a new SQLiteDatabase. It uses the DatabaseFile property as the FolderItem for the database to create.

Notes

If the database already exists, this function works like Database.Connect. If CreateDatabaseFile does not succeed, an IOException is raised. The old style where this method returned True or False is deprecated as of 2019r2. You should now catch the exception instead.

This example creates a database file and catches the exception if the operation fails:

Var f as folderitem
f = GetFolderItem("MyDatabase")
Var db as new SQLiteDatabase
db.DatabaseFile = f
Try
db.CreateDatabaseFile
Catch error as IOException
MsgBox("The database file could not be created: " + error.Message)
End Try