SQLite

Am New to Xojo… I have created the Database & connect to my project as below

Dim db As New SQLiteDatabase

Dim dbFile As FolderItem = GetOpenFolderItem(“TCP_GSM.sqlite”)

If dbFile <> Nil And dbFile.Exists Then
db.DatabaseFile = dbFile

If db.Connect Then
MsgBox(“Connected to database successfully!”)
Else
MsgBox("DB Connection Error: " + db.ErrorMessage)
End If

End If

Its working fine… but i want connect the database directly , not via folderItem…

Help me out …

GetFolderItem ?

I Hope that is FolderItem

Open Dialogue box ----> to connect the DB file

What does that mean? You don’t want to display the dialog? Then use GetFolderItem instead of GetOpenFolderItem. Otherwise, please explain what you want in more detail.

Tim,

I have saved the SQlitedatabase in my Desktop… If I run with above code dialog box was open , then i have to select my database and open.

Actually I want to connect my DB directly(If I run the application , my database will connect automatically) to my Application

( Shall i give my DB path in coding?)

If the database is in a predetermined path, you can bypass the dialog and use some combination of GetFolderItem / SpecialFolder / FolderItem.Child to get to it. For example, if the database is in the user’s Desktop with a fixed name, you can use

Dim dbFile As FolderItem = SpecialFolder.Desktop.Child("TCP_GSM.sqlite")

Thank u Tim… Its working fine… This what i expect… Thanks a lot…