Hi I m new to the VB.NET world. Please guide me with complete code as how can i connect to ms access database to VB.net form


Write the following code in form load event

Dim conn As New OleDb.OleDbConnection("Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Database Password=;Data Source=C:\Program Files\Microsoft Office\Office10\Samples\Northwind.mdb;Password=;Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk Transactions=1;Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:System database=;Jet OLEDB:SFP=False;Extended Properties=;Mode=Share Deny None;Jet OLEDB:New Database Password=;Jet OLEDB:Create System Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;User ID=Admin;Jet OLEDB:Encrypt Database=False")
Dim da As New OleDb.OleDbDataAdapter("select * from orders", conn)
Dim ds As New DataSet

After filling the dataset, fill the contents to any source like listbox,datagrid.

For datagrid,

Here i have used the existing Northwind database.Replace with your own database.

Hope you found this useful