How to connect to Access using

Posted on 2004-04-12
Last Modified: 2007-12-19
  Could someone advise me on how I could connect to an Access database using a datasource with VB.Net and create a recordset.

Any help is greatly appreciated
Question by:b3cf

Accepted Solution

gregasm earned 50 total points
ID: 10809086
Look here, this is a useful guide to creating a connection and accessing data in with ADO.NET managed oledb provider.
LVL 37

Expert Comment

ID: 10809092
Dim MyConn as OleDbConnection
Dim ConnStr as String
ConnStr=""Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\wwwroot\MyApp\MyDataBase.mdb"

MyConn= new OleDbConnection(ConnStr)
If u have database Protected with Userid add "Userid=xxxx;Password=xxxxx" to the above string

Once Connection is Opened other opearations are same as common OleDb operations

Expert Comment

ID: 10809102

    Dim rs As New ADODB.Recordset
    rs.Source = "SELECT * FROM Table"
    rs.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=""C:\dir\db.mdb"""

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
C# Single Form 8 42
Crystal reports 2 39
Database Connections Not being returned to Connection Pool 7 24
VB.NET 2008 - SQL Timeout 9 22
In my previous article ( we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Sending a Secure fax is easy with eFax Corporate ( First, just open a new email message. In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

815 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now