How to connect Microsoft Access database using

Learn VB.Net Programming in simple and easy steps. tutorial for beginner.

Establish a successful connection to a Microsoft Access Database using

How to connect Microsoft Access database using programming.

source code:

Public Class Form1
    Dim dbProvider As String
    Dim dbSource As String
    Dim con As New OleDb.OleDbConnection
    Dim sql As String
    Dim ds As New DataSet
    Dim da As OleDb.OleDbDataAdapter
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        dbProvider = "PROVIDER=Microsoft.Jet.OLEDB.4.0;"
        dbSource = "Data Source =C:\testvb\testcon.mdb"

        con.ConnectionString = dbProvider & dbSource
        MsgBox("Database is now open")
        sql = "select * from student"
        da = New OleDb.OleDbDataAdapter(sql, con)
        da.Fill(ds, "test")

        DataGridView1.DataSource = ds.Tables("test")


        MsgBox("Database is now Closed")

    End Sub

End Class