Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim conn As OleDb.OleDbConnection = GetConnection()
Dim ds As New DataSet
Dim sql As String = “select * from address”
Dim da As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter(sql, conn)
da.Fill(ds, “address”)
DataGrid1.DataSource = ds.Tables(“address”)
End Sub
Public Function GetConnection() As OleDb.OleDbConnection
‘return a new connection to the database
Return New OleDb.OleDbConnection(“Provider=Microsoft.Jet.OleDb.4.0;data source=C:test.mdb;”)
End Function

