If File.Exists (File.DirDefaultExternal ,"My.db") = False Then
File.Copy(File.DirAssets,"My.db",File.DirDefaultExternal ,"My.db")
end if
I always include the database with each install but want to be able to only copy from Dir.Assets if it has changed in structure. I understand you can't delete from Dir.Assets. Is there anywhere I can run this code which only runs on install? Any different advice is very welcome..
Add a table to the database that has a version code in it. At program start, copy the file from DirAssets to a temporary name, open, read the code, compare it to the "My.db" code and act accordingly. Unless it's a HUGE file, this should execute pretty quickly where the user doesn't notice.
I was just thinking, you can just as easily put a file in the assets directory (along with the table in your database) where the file has the version code. Then you won't have to copy the entire database to open it. Just read the file and compare to the installed database version code.
So was I )) I have put a field in my db with the number in it, and a corresponding number in my app code.. When the new version is issued then the app number will compare to the existing db field and if different then copy the dir.assets db into the dir.internal and open that one.. That'll work too I think.. thank you for your thoughts especially being a Friday afternoon..