Connecting to Access Database ASP.NET

Joined
Jan 10, 2007
Messages
43,898
Location
In The Machine
Hello all.

I am having a bit of trouble connecting to my access database.

*** Public Sub ReturnUsers(ByVal connectionString As String)
******* Dim queryString As String = "SELECT * FROM users;"
******* Using connection As New Data.SqlClient.SqlConnection(connectionString)
*********** Dim command As New Data.SqlClient.SqlCommand(queryString, connection)
*********** connection.Open()
*********** Dim reader As Data.SqlClient.SqlDataReader = command.ExecuteReader()
*********** Try
*************** While reader.Read()
******************* Console.WriteLine(String.Format("{0}, {1}", _
*********************** reader(0), reader(1)))
*************** End While
*********** Finally
*************** ' Always call Close when done reading.
*************** reader.Close()
*********** End Try
******* End Using
*** End Sub

That's how I'm returning the users in the database. My connection string is : "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("users.mdb")

The error I'm getting is Keyword not supported: 'provider'.

I'm having trouble understanding why it's giving me this error when I got the connectionstring from connectionstrings.com

Any insight would help.

Much thanks and happy holidays.




More...

View All Our Microsft Related Feeds
 

Similar threads

R
Replies
0
Views
103
Rob Slabbekoorn
R
V
Replies
0
Views
115
VB Novice Hendri
V
C
Replies
0
Views
74
CSharp Enthusiast
C
Back
Top