Neh Source Code Nyomot Dari Warung sebelah tentang Koneksi Vb.net terhadap MS.access...
- Code:
Import System.Data.OleDb
public class form1
dim kns as new OleDbConnection
dim da as new OleDbDataAdapter
dim dt as new datatable
Public Sub form1_load( ...... ) mybase.load
'ini utk access 2003 kebawah
kns.ConnectionString = "Provider = Microsoft.Jet.OleDb.4.0;data source=mydata.mdb;Jet Oledb:Database Password='passku'"
'Ni tuk Access 2007 kebawah
'kns.ConnectionString = "Provider = Microsoft.Ace.OleDb.12.0;data
source=*.mdb/*accdb;Jet Oledb:Database Password='passku'"
da.SelectCommand=new oledbCommand("select * from tabel1",kns)
da.fill(dt)
datagridview1.datasource=dt
end sub
end class