Hi all,
I've got my restore database code working good but was wondering if there is anyway to get some feedback from the SQL server during the restore?
Dim sqlstr As String
sqlstr = "restore database " + dbNameFinal + " from disk ='" + tbBAKpath.Text + "' with move '" + originalDBname + "' to '" + tbRestorePath.Text + "\" + dbNameFinal + ".MDF' , move '" + origianlLOGname + "' to '" + tbRestorePath.Text + "\" + dbLogNameFinal + ".LDF'"
Dim SQLConn As New SqlConnection() 'The SQL Connection
Dim SQLCmd As New SqlCommand() 'The SQL Command
SQLCmd.CommandTimeout = 600
SQLConn.ConnectionString = ConnString 'Set the Connection String
SQLConn.Open() 'Open the connection
SQLCmd.Connection = SQLConn 'Sets the Connection to use with the SQL Command
SQLCmd.CommandText = sqlstr 'Sets the SQL String
'MessageBox.Show(sqlstr)
Try
Dim dr1 As SqlDataReader
dr1 = SQLCmd.ExecuteReader() 'Executes SQL Commands Non-Querys only
While dr1.Read
lblSQLcommandStatus.Visible = True
lblSQLcommandStatus.Text = dr1.ToString
End While
Me.Cursor = Cursors.Default
Catch ex As Exception
MessageBox.Show(ex.Message)
Me.Cursor = Cursors.Default
End Try
I've tried this back it doesnt do anything.
Thanks in advance...