Dim sCodice As String
Dim sIns As String
SQL1.Initialize(DBDirName,DBFileName,False)
ResultSet1=SQL1.ExecQuery("SELECT * FROM Impostazioni")
Do While ResultSet1.NextRow
sCodice=ResultSet1.GetString("codice_utente").Trim & ".db"
sIns=ResultSet1.GetString("mail_insegnante").trim
Loop
SQL1.Close
File.Copy(DBDirName,DBFileName,DBDirName,sCodice)
Dim sDir As String = "/apmobi"
Dim sFile As String = "/" & sIns & "/" & sCodice
ftp.Initialize("ftp", sServer, 21, sUserId, sPassword)
ftp.PassiveMode = True
Dim sf As Object = ftp.UploadFile(DBDirName, sFile, False, sDir)
Wait For (sf) ftp_UploadCompleted (ServerPath As String, success As Boolean)
If success Then
Log("file was uploaded successfully")
Else
Log("Error uploading file")
End If