I have a database file stored on my SD card and I want to be able to back it up and restore it.
The file appears to copy just fine:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
So my database is now backed up.
I delete a record by mistake and go to restore the database.
Again, the file appears to copy just fine:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
I return to my screen happy in the knowledge that my record will have reappeared. Except that it doesn't.
:BangHead:
Here is my code:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
Everything I've read so far says it should work. So where am I going wrong. I run the program on a HTC Desire HD. Please help :sign0085:
			
			The file appears to copy just fine:
			
				B4X:
			
		
		
		File.Copy(File.DirDefaultExternal, "mydb.s3db", File.DirDefaultExternal, "mydb.bak")So my database is now backed up.
I delete a record by mistake and go to restore the database.
Again, the file appears to copy just fine:
			
				B4X:
			
		
		
		File.Copy(File.DirDefaultExternal, "mydb.bak", File.DirDefaultExternal, "mydb.s3db")I return to my screen happy in the knowledge that my record will have reappeared. Except that it doesn't.
:BangHead:
Here is my code:
			
				B4X:
			
		
		
		Sub Process_Globals
   
   'Database
   Dim SQL1 As SQL
   Dim DBFileDir As String         : DBFileDir = File.DirDefaultExternal
   Dim DBFileName As String      : DBFileName = "mydb.s3db"
   Dim DBFileBak As String         : DBFileBak = "mydb.bak"
End Sub
Sub BackupButton_Click
   
   SQL1.Close
   File.Copy(DBFileDir, DBFileName, DBFileDir, DBFileBak)
   SQL1.Initialize(DBFileDir, DBFileName, True)
   Msgbox("Database has been Backed Up", "")
   
End Sub
Sub RestoreButton_Click
   
   SQL1.Close
   File.Copy(DBFileDir, DBFileBak, DBFileDir, DBFileName)
   SQL1.Initialize(DBFileDir, DBFileName, True)
   Msgbox("Database has been Restored", "")
End SubEverything I've read so far says it should work. So where am I going wrong. I run the program on a HTC Desire HD. Please help :sign0085:
 
				 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		