Simple Access DB connection Not working

  • Thread starter Thread starter Joe
  • Start date Start date
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,
 
Back
Top