slqite3 issue

Post

Posted
Rating:
#1 (In Topic #1181)
Trainee
 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
Online now: No Back to the top

Post

Posted
Rating:
#2
Guru
BruceSteers is in the usergroup ‘Guru’
 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
Online now: No Back to the top

Post

Posted
Rating:
#3
Avatar
Regular
thatbruce is in the usergroup ‘Regular’
 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

Online now: No Back to the top
1 guest and 0 members have just viewed this.