Solved

How to connect to Access using VB.net

Posted on 2004-04-12
5
1,411 Views
Last Modified: 2007-12-19
Hi
  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
thanx
0
Comment
Question by:b3cf
5 Comments
 
LVL 8

Accepted Solution

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

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskcreatingconnectiontoaccessdatabase.asp
0
 
LVL 37

Expert Comment

by:gregoryyoung
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
0
 
LVL 3

Expert Comment

by:monkesdb
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"""
    rs.Open
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
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.

821 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