Simple Access DB connection Not working

J

Joe

I am trying to create a simple connection to a Access DB
and receive the following OleDbException error

System.Data.OleDb.OleDbException: Unspecified error at
System.Data.OleDb.OleDbConnection.ProcessResults(Int32
hr) at
System.Data.OleDb.OleDbConnection.InitializeProvider() at
System.Data.OleDb.OleDbConnection.Open() at
RepNetWeb.Events.BindData() in
C:\projects\kuhns\repIntranet\repNetWeb\Pages\Events\Event
s.aspx.vb:line 47

I am using the following code in


Sub BindData()
Dim ConnectionString As String
= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath("..\..\Files\dB\KBWEB.MDB")

Dim QuerySQL As String = "SELECT * FROM KBEVENTS"

Dim objConn As New OleDbConnection
(ConnectionString)
Dim objCmd As New OleDbCommand(QuerySQL, objConn)

Try
objConn.Open()
dgEvents.DataSource = objCmd.ExecuteReader()
dgEvents.DataBind()

Catch ex As OleDbException
lblError1.Text = ConnectionString
lblError2.Text = ex.ToString
Finally
objConn.Close()
End Try

End Sub

The code runs fine on some machines but recieved the
above mentioned errors on others. I have checked the
permisions on the file and the folder and everything is
identical. Any help is greattly appreciated.

Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top