From Xojo Documentation

Revision as of 15:07, 8 August 2017 by PLefebvre (talk | contribs)

SQLiteDatabase.CreateDatabaseFile() As Boolean

Supported for all project types and targets.

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


If the database already exists, this function works like Database.Connect. CreateDatabaseFile returns True if the new database was created successfully or an existing database was opened successfully. Otherwise it returns False.


This example creates a new database:

Dim f As FolderItem
f = New FolderItem("MyDB.sqlite")

Dim db As New SQLiteDatabase
db.DatabaseFile = f
If db.CreateDatabaseFile Then
// proceed with database operations...
MsgBox("Database not created. Error: " + db.ErrorMessage)
End If