vb.net - Access Connection

Posted on 2005-04-21
Medium Priority
Last Modified: 2010-04-23
       Any one give me some example of Simply connection of vb.net with MS Access Database ( .mdb)
        with functionality like add,delete,update,select
        It should be preetymuch same like we are doing in Adodb connection in VB 6.0
Question by:vsvb
1 Comment
LVL 25

Accepted Solution

RonaldBiemans earned 750 total points
ID: 13832195
Well there are a couple of thisng you can do

1. just drop a oledbdataadapter from the toolbox on your form and follow the wizard
2. do something like this
dim conn as new oledb.oledbconnection(Me.OleDbConnection1.ConnectionString = "Jet OLEDB:Registry Path=;Data Source=""C:\Program Files\My APP\DlrData.mdb"" & _
        ";Jet OLEDB:System database=;Jet OLEDB:Global Bulk Transactions=1;Jet OL" & _
        "EDB:Don't Copy Locale on Compact=False;User ID=Admin;Provider=""Microsoft.Jet.OLE" & _
        "DB.4.0"";Jet OLEDB:Database Locking Mode=0;Jet OLEDB:SFP=False;Jet OLEDB:Encrypt " & _
        "Database=False;Jet OLEDB:Create System Database=False;Jet OLEDB:Compact Without " & _
        "Replica Repair=False;Jet OLEDB:Global Partial Bulk Ops=2;Mode=Share Deny None;Ex" & _
        "tended Properties=;Jet OLEDB:Engine Type=4")

dim da as new oledb.oledbdataadapter("select * from yourtable",conn)
dim dt as new datatable


to update delete insert data you can use a commandbuilder object which will regenate the command for you

dim cb as new oledb.oledbcommandbuilder(da)
'to update your data
just use


3. You can write the update/delete/insert commands yourself (just drag a oledbadapter from the toolbox and look in the windows generated code how it should be done)

which one to use is your own preference (In 90% of the cases I use method 1, I never use method 2, and method 3 only if I have a special case (like many to many relationship or I need to do something special)


Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question