'Copies a database file that was added in the Files tab.
'The database must be copied to a writable location.
'This method copies the database to the storage card.
'If the storage card is not available the file is copied to the internal folder.
'The target folder is returned.
'If the database file already exists then no copying is done.
Sub CopyDBFromAssets (FileName As String) As String
Peter .. Are you utilizing DBUtils ? or dealing directly with SQLite ?
It is not neccessary to involve DBUtils to do what you wish , unless you've already gone down that path.
Just create a db file on your PC then include it in your app .. by way of the IDE Files tab as LucaMS suggested.
Run your app and copy the file to a writable location ie ..
B4X:
If File.Exists(File.DirDefaultExternal, "Database.db") = False Then
File.Copy(File.DirAssets, "Database.db", File.DirDefaultExternal, "Database.db")
End If
'then ...
SQL1.Initialize(File.DirDefaultExternal, "Database.db", True)
'and start your SQL queries etc
Edit ..
If you do not already have these .. 2 Free DB Creation / Editing Software
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.