Code:
Imports System.Data.OleDb
Public Class Form1
Dim conn As OleDbConnection
Dim constring As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Denden\Desktop\DB.mdb" 'i remove my db on desktop
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
conn = New OleDbConnection(constring)
Try
If conn.State <> ConnectionState.Open Then
conn.Open()
MsgBox("connected")
Else
MsgBox("failed")
End If
Catch ex As Exception
ex.Message.ToString()
End Try
conn.Close()
End Sub
End Class
Comment