Connect to embedded sqlite database

Having trouble connecting to a existing embedded SQLite database. Have tried many examples but nothing works.
I need example code that will connect with the database. Preferably in the current application.

'mDB = new SQLiteDatabase
'//var f as FolderItem
'//f = App.ExecutableFile.Parent.Parent.Child(“Resources”).Child(“Parts.sqlite”)
'dim f as xojo.IO.FolderItem = Xojo.IO.SpecialFolder.GetResource(“Parts.sqlite”)

'if f <> Nil and f.Exists then
'if mDB.Connect then
'var rs as RowSet= mDB.SelectSQL(“select * form Main”)
'end if
'end Try
'end if

dim db as SQLiteDatabase
if db.Connect then
dim rs as RecordSet = db.SQLSelect(“SELECT sqlite_version()”)
if rs <> nil then
end if
end if

thats my DB class with setting super to SQLiteDatabase.
Resources is somehow a template folder.
i run this web service at pc in a user context and use the database in a sub folder
of documents.

Public Sub Constructor()
  // Calling the overridden superclass constructor.
  Self.DatabaseFile = File()
End Sub

Public Sub Destructor()

End Sub

Public Function File() As FolderItem
  Var f As FolderItem = SpecialFolder.Documents.Child("Database").Child("MarkusBüro.Xojo.sqlite")
  System.DebugLog f.NativePath
  Return f
End Function

Please explain where this code goes.

you add a class and then add this methods

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.