Hi, I have the below code to replace an sqlite database file from internet. The code seems to run OK, but after I have replaced the .db, when I run a query against the database I receive an error that the database disk image is malformed. All help appreciated, thanks
Sub JobDone (Job As String)
Dim In As InputStream, Out As OutputStream
If HttpUtils.IsSuccess(dlfilename) Then
In = HttpUtils.GetInputStream(dlfilename)
Out = File.OpenOutput(dir, "update.db", False)
Out.Flush
File.copy2(HttpUtils.GetInputStream(dlfilename),File.OpenOutput(dir, "update.db", False) )
Out.Close
SQL1.Close
File.copy(dir,"fiestas.db",dir,"old.db")
File.copy(dir,"update.db",dir,"fiestas.db")
SQL1.Initialize(dir, "fiestas.db", False)
ToastMessageShow("¡Ya los datos estan actualizados!", False)
'Button_InstallUpdate.Enabled = False
Else
'Button_InstallUpdate.Enabled = False
ToastMessageShow("No se puede conectar con el Servidor: ¡Compruebe tu conexion de Internet!",True)
End If
HttpUtils.Complete = False
End Sub