download gratis video tutorial vb 6 dan vb.net plus contoh aplikasi

cara koneksi vb.net dengan database access 2003

 

 

 


Imports System.Data.OleDb

 

Public Class form1

Dim conn As OleDbConnection
Dim da As OleDbDataAdapter
Dim ds As DataSet

 

Sub koneksidb()
conn = New OleDbConnection("provider=microsoft.ace.oledb.12.0;data source=DBACCESS2007.accdb")
conn.Open()
End Sub


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Call koneksidb()
da = New OleDbDataAdapter("select * from tblbarang", conn)
ds = New DataSet
da.Fill(ds)
DataGridView1.DataSource = ds.Tables(0)
DataGridView1.ReadOnly = True
End Sub
End Class