Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim _sConnectString As String
_sConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source =D:\vb60实例\mdb\score01.mdb"
Dim _ConnectOledb As New OleDb.OleDbConnection(_sConnectString)
Try
_ConnectOledb.Open()
If _ConnectOledb.State = ConnectionState.Open Then
MessageBox.Show("已经连接成功")
Else
MessageBox.Show("还没连接")
End If
Catch ex As OleDb.OleDbException
MessageBox.Show("无法连接")
Finally
If _ConnectOledb.State = ConnectionState.Open Then
_ConnectOledb.Close()
End If
_ConnectOledb = Nothing
End Try
End Sub