Using Existing Database Read Only

touchsquid

Active Member
Licensed User
Longtime User
I am trying to initialize an existing sqlite file in Basic4Android. This is the code

If File.Exists(File.DirAssets,"FKOOKY.sqlite") Then
SQL1.Initialize(File.DirAssets,"FKOOKY.sqlite",False)
Else
Msgbox("Missing Dbase","Error")
End If

I get a "unable to open database" exception on the second line. The database opens OK in sqlite tools. I tried copying it to files.DirInternal but it made no difference. Any ideas?
 

touchsquid

Active Member
Licensed User
Longtime User
Works now

This code works now. It seems database in the Assets folder will not work, even if you want it read only.

If File.Exists(File.DirInternal,"FKOOKY.sqlite") Then
SQL1.Initialize(File.DirInternal,"FKOOKY.sqlite",False)
Else
File.Copy(File.DirAssets,"FKOOKY.sqlite",File.DirInternal,"FKOOKY.sqlite")
SQL1.Initialize(File.DirInternal,"FKOOKY.sqlite",True)
End If
 
Upvote 0
Top