急问,datagrid中改变某行颜色;恢复数据库
Private Sub BackRest_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ServerName As String
Dim UserName As String
Dim Password As String
Try
If gSQLServer Is Nothing Then
gSQLServer = New SQLDMO.SQLServer
End If
ServerName = "(local)"
UserName = ""
Password = ""
gSQLServer.LoginSecure = True
Try
System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor
gSQLServer.Connect(ServerName, UserName, Password)
gbConnected = True
System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default
Catch ex As SqlException
MsgBox(ex.Message)
End Try
Exit Sub
Catch
MsgBox("错误: " & Err.Description)
If System.Windows.Forms.Cursor.Current.Equals(System.Windows.Forms.Cursors.WaitCursor) Then
System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default
End If
End Try
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Try
If (br.conn.State = ConnectionState.Open) Then
br.conn.Close()
End If
Dim oRestore As SQLDMO.Restore
Dim Msg As String
Dim Response As String
gDatabaseName = "Library"
oRestore = New SQLDMO.Restore
oRestoreEvent = oRestore
oRestore.Database = gDatabaseName
gBkupRstrFileName = "c:\Library.bak"
oRestore.Files = gBkupRstrFileName
System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor
'恢复数据库
oRestore.SQLRestore(gSQLServer)
System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default
oRestoreEvent = Nothing
oRestore = Nothing
Exit Sub
Catch
MsgBox("错误 " & Err.Description)
End Try
End Sub
-------------------------
1..如何改变不符合条件的某行,如超额的那行为红色。
2..为什么我在恢复数据库时有错。备份是可以的。
谢谢了