-
Access ODBC from VB.NET 2008
Hello,
I am new to using access.
I am trying to read data from Access db using ODBC.
here is the code:
***********
Dim oODBCConnection As OdbcConnection
Dim sConnString As String = _
"Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=C:\\db1.mdb;" & _
"Uid=user;" & _
"Pwd=password"
oODBCConnection = New Odbc.OdbcConnection(sConnString)
oODBCConnection.Open()
MsgBox("Connected")
Dim odr As OdbcDataReader
Dim cmd As New OdbcCommand()
cmd.Connection = oODBCConnection
cmd.CommandText = "SELECT * FROM Email"
odr = cmd.ExecuteReader()
odr.Read()
MsgBox(odr("tblID").ToString())
************
The program bails out at cmd.ExecuteReader(). I keep getting the following error:
ERROR [42000] [Microsoft][ODBC Microsoft Access Driver] Record(s) cannot be read; no read permission on 'Email'
We do have a security enabled on the databases. I checked in Tool --> Security --> User and Group Permissions and 'user' does have read/write permission to the 'email' table.
Any ideas what I am doing wrong?
Thanks in advance,
J!
Last edited by junOOni; 10-23-2008 at 11:58 AM.
-
I got it. I had to add the workgroup path (in Bold):
Dim sConnString As String = _
"Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=C:\\db1.mdb;SystemDB=pathtomdw;" & _
"Uid=uid;" & _
"Pwd=password"
Thanks anyway,
J!
Last edited by junOOni; 11-11-2008 at 01:50 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|