VB 2013 - DB Access 2003 (mdb) Connection

VB .Net 2013 - DB Access 2003 (mdb) Connection
This is Tutorial Visual Basic .Net 2013 : How to connect Database MS Access 2003 (.mdb)
  • Step 1: Create New Project use VB 2013
  • Step 2 :Create database and table in MS Access 2003
  • Step 3 : Design form in VB .Net 2013
#Step 1 :
Make sure you already install VB 2013 in your computer

See Also : Create Project POS Application Using VB Net 2013

Open Visual Studio 2013
Click Visual Studio 2013

Click File - New - Project
after that like below picture :
VB 2013 - DB Access 2003 (mdb) Connection
Click OK
After that, please follow STEP 2
#Step 2 :
Create Database use MS Access 2003
Database name : db.mdb
Table name : TBL_PRODUCT
design table like below picture :


fill sample product
 Save db.mdb at : D:\MyApp\MyApp\MyApp\bin\Debug

 #Step 3 :
Design form1 like below picture
Just add "Datagridview1" in Form1

Fill below code at Form1

Imports System.Data.OleDb
Public Class Form1
    Dim Conn As OleDbConnection
    Dim da As OleDbDataAdapter
    Dim ds As DataSet
    Dim DBLocation As String
    Sub DBConn()
        DBLocation = "provider=microsoft.jet.oledb.4.0;data source=DB.mdb"
        Conn = New OleDbConnection(DBLocation)
        If Conn.State = ConnectionState.Closed Then Conn.Open()
    End Sub
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        DBConn()
        da = New OleDbDataAdapter("Select * from TBL_Product", Conn)
        ds = New DataSet
        ds.Clear()
        da.Fill(ds, "TBL_Product")
        DataGridView1.DataSource = (ds.Tables("TBL_Product"))
    End Sub
End Class
Here the result :
Please click here to download project / source code above and Stay tuned for our next lesson :)

Subscribe to receive free email updates:

0 Response to "VB 2013 - DB Access 2003 (mdb) Connection"

Post a Comment