Var dbFile As New FolderItem("MyDB.sqlite")
Var db As New SQLiteDatabase
db.DatabaseFile = dbFile
'db.EncryptionKey = "horse+20$"
Try
db.Connect
' Key was correct; DB is connected
MessageBox("Connected to database.")
Catch error As DatabaseException
' Connection error. This could be because the key is wrong or other reasons
MessageBox("Connection error: " + error.Message)
End Try
Database file doesn’t exist in the specified location.
So this should work:
Var dbFile As New FolderItem("MyDB.sqlite")
Var db As New SQLiteDatabase
db.DatabaseFile = dbFile
db.EncryptionKey = "horse+20$"
Try
If Not dbFile.Exists Then
db.CreateDatabase
End If
db.Connect
' Key was correct; DB is connected
MessageBox("Connected to database.")
Catch error As DatabaseException
' Connection error. This could be because the key is wrong or other reasons
MessageBox("Connection error: " + error.Message)
End Try
To encrypt a new database, specify this value before calling CreateDatabase.
To connect to an encrypted database, specify this value before calling Database.Connect.