Cannot open database

Shay

Well-Known Member
Licensed User
Longtime User
no using external storage
(due to security - since cannot passwork protect the database)

using the following, the product.db exist on my bas (main direcory) also tried under files dir.

my code is
Sub Activity_Create(FirstTime As Boolean)

Activity.LoadLayout("AssembleList") 'Load the layout file.

If SQL1.IsInitialized = False Then
SQL1.Initialize(File.DirDefaultExternal,"Products.db", False)
End If

End Sub

getting error:
"unable to open databse file"

tried also changing the file.Dir to
SQL1.Initialize(File.DirInternal,"Products.db", False)
SQL1.Initialize(File.DirAssets,"Products.db", False)
SQL1.Initialize(File.DirRootExternal,"Products.db", False)

please help
 

Shay

Well-Known Member
Licensed User
Longtime User
I think it is not related to DB
I cannot find any file in my project directory
any suggestions?
 
Upvote 0

eps

Expert
Licensed User
Longtime User
Have you got the DB in the Files directory? If so try code along the lines of (to copy it from Assets to External)

If File.Exists(File.DirInternal,"thedata.db") = False Then
File.Copy(File.DirAssets,"thedata.db",File.DirInternal,"thedata.db")
End If

If SQL1.IsInitialized = False Then
SQL1.Initialize(File.DirInternal, "thedata.db", False)
End If

Are you running in the emulator? Have you got storage defined?
 
Upvote 0

Shay

Well-Known Member
Licensed User
Longtime User
Actually this is new project
do i need to reconfigure some paths?
(since i didn't have any problem on last projects (used wav files))

the db file exist in my project directory, but the emulator cannot find it

i don't wish to use external storage due to security issue

any suggestions
 
Upvote 0

Shay

Well-Known Member
Licensed User
Longtime User
fixed it
manually copied the db file to files directory
and coping the file from assets to internal

thanks for your help
 
Upvote 0
Top