Page 1 of 1

slqite3 issue

Posted: Sunday 28th January 2024 12:29am
by vdubeau
I tried following examples. my code is below:

Dim $con As New Connection
Try $con.Close()
$con.Type = "sqlite3"
$con.host = "./"
$con.name = "Invoices.db"
$con.Open
I get the message "Unable to locate database 'invoices.db' in ./"

I have the database file in the directory where the program resides.
What am i doing wrong? Any help is appreciated.

Thanks

Re: slqite3 issue

Posted: Sunday 28th January 2024 1:47am
by BruceSteers
did you try an absolute path?

$con.host = Application.Path

I'd use the ./ path only for reading files, for writing (or other uses, i guess db) then i'd use Application.Path

Re: slqite3 issue

Posted: Monday 29th January 2024 12:55am
by thatbruce
Two notes:
1) You CANNOT write to a database inside the executable(nor any other file inside the executable.) The database must exist outside the executable.
2) As Bruce says you must use a FULL path to the sqlite file. Read up up on how Gambas uses relative paths.
b