Private Sub Connect()
On Error Goto ErrHandler
Dim Cn AS New Adodb.Connection
Cn.open "..."
Msgbox "Success!"
Exit Sub
ErrHandler:
MsgBox Err.Description
End Sub
On Error Goto ErrHandler
Dim Cn AS New Adodb.Connection
Cn.open "..."
Msgbox "Success!"
Exit Sub
ErrHandler:
MsgBox Err.Description
End Sub
Err.Clear cnn.open"....." If Err.Number <> 0 Then
MsgBox ("不能打开数据库!"), 48, "数据库连接错误"
End
End If