The Emulator can not open database file - why?

TatyanaP

Member
Licensed User
Longtime User
:sign0085:
1.
in the device Samsung Galaxy Tab P1000 my data base is opened and I can see my tables in it, but the similar Emulator occured the error: "unable to open database file", but in the same time in directory DirAssets database file exists:

If File.Exists(File.DirAssets, DBFileName) = True Then
SQL1.Initialize(File.DirAssets,DBFileName,False) ---> error occurs!
End If


2.
In attempt to copy the file of database on other folders,

File.Copy(File.DirAssets, DBFileName, File.DirInternal, DBFileName)
File.Copy(File.DirAssets, DBFileName, File.DirRootExternal, DBFileName)

too gives errors:

3.
I can not see SD card in the Emulator although when I created the emulator give it SD card size 16 MiB.

It would be convenient to me to make debugging the program in the Emulator - somebody will help me?
 

TatyanaP

Member
Licensed User
Longtime User
the Emulator can not copy DB file from assets to internal or SDcard

1.
At first removed the old Emulator, then created a new Emulator and attached to it new hardware - the CD card, thank you, klaus! :sign0013:

2.
But the new Emulator can not copy DB file from assets to SDcard as before:

Sub CopyDBFromAssets
Dim TargetDir As String
If File.ExternalWritable Then TargetDir = File.DirRootExternal ' Else TargetDir = File.DirInternal
If File.Exists(TargetDir, DBFileName) = True Then
File.Delete(TargetDir, DBFileName)
Msgbox(" DB Deleted!! "&TargetDir,"attention!!!")
End If
If File.Exists(TargetDir, DBFileName) = False Then
File.Copy(File.DirAssets, DBFileName, TargetDir, DBFileName)
End If
End Sub


The Emulator find the DB file in DirRootExternal and DB file is deleted from the card, it seems to me any piece of file was copied, but not completely.

Size of DB file is 2.2MB = 2286KB
Size of SD card is 16M

ERROR occurs at line:

File.Copy(File.DirAssets, DBFileName, TargetDir, DBFileName)

where TargetDir = File.DirRootExternal

Please look at the attached file pic.jpg

I tried with TargetDir = File.DirInternal but get the same error.

Where there can be a mistake in my codes ? :sign0085:
 
Upvote 0

TatyanaP

Member
Licensed User
Longtime User
:)

After changing the extension of the database from "db" to "jpg",
I at last saw my DB in the Emulator!

Thank you dear Erel, it works... :icon_clap:
 
Upvote 0
Top