Private Sub Button1_Click
If Not(DbM.IsInitialized) Then
DbM.Initialize(dbpath,Main.dbmname,False)
End If
Dim qry As String="insert into movimenti (idterm,UID,dataora,causale,modoctr,note)" &" values("""&"1234567890"&""","""&"idute=7456"&""","""&"oggi"&""","""&"L"&""","""&"attivo"&""","""&"NO"&""")"
Dim SenderFilter As Object = B4XPages.MainPage.DbM.ExecQueryAsync("SQL",qry,Null)
Wait For (SenderFilter) SQL_QueryComplete (Success As Boolean, rs As ResultSet)
If Success Then
DbM.close
End If
End Sub
#Region gestione FTP 'esegue aggiornamento tablet prima scarica , poi carica dati ed infine tenta di aggiornare app
Sub FTP_Start
DoFTPInitialize
If Main.statoFTP="UP" Then
' Main.FtpStatus.down=False
' Main.FtpStatus.up=False
' Main.FtpStatus.apk=False
End If
End Sub
Sub DoFTPInitialize
Main.FTP.Initialize("FTP","ftp.xxxx.xx",21,"xxx","@@@@@@")
Main.FTP.PassiveMode=True
' If trasferito Then
' installaApk("otto.apk")
' Return
' End If
If Main.statoFTP="UP" Then
'Log("Sending File...")
'logdb("trasferisco dati")
Dim data,yy,hh As String
DateTime.DateFormat="yyyyMMdd"
DateTime.TimeFormat="HHmmss"
hh=DateTime.Time(DateTime.Now)
yy=DateTime.Date(DateTime.Now)
data=yy&hh
nomefiletx="1234567890_"&data&".s3db"
Dim up As Object=Main.FTP.UploadFile(dbpath, nomefiletx,False, nomefiletx)
Wait For (up) FTP_UploadCompleted (ServerPath As String, Success As Boolean)
If Success Then
FTP_UploadCompleted(ServerPath, Success)
Else
nomefiletx="no" 'messaggi.Visible=False
End If
End If
End Sub
Sub FTP_UploadCompleted (ServerPath As String, Success As Boolean)
If Main.statoFTP="UP" Then
File.delete(dbpath,nomefiletx)
DbM.Initialize(dbpath,Main.DbMName,False)
If Success Then
nomefiletx=""
DbM.ExecNonQuery("delete from movimenti")
End If
End If
End Sub
#End Region
Private Sub Button2_Click
Main.statoFTP="UP"
FTP_Start