Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Connecting to an Access Table
Message
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01059787
Message ID:
01059788
Views:
12
I need to connect to an Access table using VB.Net and then run a query
and return the results.

Can someone provide an example?


Hi, Kevin,

How about this?
Imports System.Data.OleDb

Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader

cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\emp.mdb;")
cn.Open()
cmd = New OleDbCommand("select * from table1", cn)
dr = cmd.ExecuteReader
While dr.Read()
   ' do something with the datareader  TextBox2.Text = dr(1)
End While
If you google on "VB.NET" and "MSACCESS" (or other keywords), you're likely to find many examples.

Hope that helps....
Kevin
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform