Hi all
I have created a small tool for myself for backing up my MS SQL databases.
Now I'm trying to implement resumable subs.
My jSQL library is updated to 1.50. This is my code so far. My backups are created but I don't know which event to use in the wait for.
Basicly I would like to transfer the output of my backup to a logfile as in the SQL management studio.
Output SQL management studio
I have created a small tool for myself for backing up my MS SQL databases.
Now I'm trying to implement resumable subs.
My jSQL library is updated to 1.50. This is my code so far. My backups are created but I don't know which event to use in the wait for.
Basicly I would like to transfer the output of my backup to a logfile as in the SQL management studio.
B4X:
Sub BackupDbase(database As String, loc As String)
Dim query As String = $"BACKUP DATABASE ["$ & database & $"] TO DISK = N'"$ & loc & $"\"$ & database & $".bak' WITH NOFORMAT, INIT, SKIP, NOREWIND, NOUNLOAD, STATS = 10"$
conn.ExecNonQuery2(query,Null)
wait For (conn) conn_ready (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String) 'Which event should be used here??
If Success And ExitCode = 0 Then
Log("Success")
Log(StdOut)
Else
Log("Error: " & StdErr)
End If
End Sub
Output SQL management studio
B4X:
10 percent processed.
20 percent processed.
30 percent processed.
40 percent processed.
50 percent processed.
60 percent processed.
70 percent processed.
80 percent processed.
90 percent processed.
Processed 23840 pages for database 'CAFCA', file 'CAFCA_Data' on file 1.
100 percent processed.
Processed 2 pages for database 'CAFCA', file 'CAFCA_Log' on file 1.
BACKUP DATABASE successfully processed 23842 pages in 3.650 seconds (51.029 MB/sec).