How to open a SQLite DataBase

I have sreated a SQLite DataBase with Xojo.
Now a like to use this DataBase with a other Xojo Programm.
The program is started with:

Dim dbFile As New FolderItem("Sponingen.sqlite")

But i can not connect the DataBase.

Have you placed the db file next to your executable? Does the error occur when you Run the project, or in the built application? (The location may change when Run from the IDE vs. built.)

Examine dbfile.NativePath to see if it is what you expect.

I have written:

Dim FileDB As New FolderItem("Sponingen.sqlite") MsgBox(FileDB.NativePath)
This give the right path.
By Properties I have make the SQLite DB with the name “SponningenDB”
And in the code:

SponningDB = New SQLiteDatabase SponningDB.DatabaseFile = FileDB
What is wrong??
Can some body give me a example code for opening, writing in and read a existing SQLite file?

This example is taken from the LR at: http://documentation.xojo.com/index.php/Sqlite
See if it works :slight_smile:

Dim dbFile As FolderItem
Dim db As New SQLiteDatabase
dbFile = GetFolderItem("Sponingen.sqlite")
db.DatabaseFile = dbFile
If db.Connect Then
  MsgBox("Connected")
Else
  MsgBox("The database couldn't be opened. Error: " + db.ErrorMessage)
End If

Thanks, it hase been work very well