SQLiteDatabase.EncryptionKey

From Xojo Documentation

Revision as of 17:04, 12 February 2013 by PLefebvre (talk | contribs) (Created page with '{{PropertyBox | name=EncryptionKey | owner=SQLiteDatabase | ownertype=class | scope=public | type=String | platform=all }} {{Description |text = Specifies the encryption …')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Property (As String )
aSQLiteDatabase.EncryptionKey = newStringValue
or
StringValue = aSQLiteDatabase.EncryptionKey

Supported for all project types and targets.

Specifies the encryption key used to create or connect to an encrypted database.


Notes

To encrypt a new database, specify this value before calling CreateDatabaseFile.

To connect to an encrypted database, specify this value before calling Database.Connect.

To encrypt an existing database, use the Encrypt method.


Example

This example supplies EncryptionKey before attempting to connect to an encrypted database:

Dim dbFile As GetFolderItem("MyDB.sqlite")

Dim db As New SQLiteDatabase
db.DatabaseFile = dbFile

db.EncryptionKey = "horse+20$"

If db.Connect Then
// Key was correct; DB is connected
MsgBox("Connected to database.")
Else
// Connection error. This could be because the key is wrong or other reasons
MsgBox("Connection error: " + db.ErrorMessage)
End If