Simple Access DB connection Not working

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Joe

    #1

    Simple Access DB connection Not working

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

    System.Data.Ole Db.OleDbExcepti on: Unspecified error at
    System.Data.Ole Db.OleDbConnect ion.ProcessResu lts(Int32
    hr) at
    System.Data.Ole Db.OleDbConnect ion.InitializeP rovider() at
    System.Data.Ole Db.OleDbConnect ion.Open() at
    RepNetWeb.Event s.BindData() in
    C:\projects\kuh ns\repIntranet\ repNetWeb\Pages \Events\Event
    s.aspx.vb:line 47

    I am using the following code in


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

    Dim QuerySQL As String = "SELECT * FROM KBEVENTS"

    Dim objConn As New OleDbConnection
    (ConnectionStri ng)
    Dim objCmd As New OleDbCommand(Qu erySQL, objConn)

    Try
    objConn.Open()
    dgEvents.DataSo urce = objCmd.ExecuteR eader()
    dgEvents.DataBi nd()

    Catch ex As OleDbException
    lblError1.Text = ConnectionStrin g
    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,
  • alien2_51

    #2
    Re: Simple Access DB connection Not working

    Don't use a datareader as a datasource to databind to... ever..

    "Joe" <jjf@itgsytems. com> wrote in message
    news:27a101c379 46$67e701d0$a60 1280a@phx.gbl.. .[color=blue]
    > I am trying to create a simple connection to a Access DB
    > and receive the following OleDbException error
    >
    > System.Data.Ole Db.OleDbExcepti on: Unspecified error at
    > System.Data.Ole Db.OleDbConnect ion.ProcessResu lts(Int32
    > hr) at
    > System.Data.Ole Db.OleDbConnect ion.InitializeP rovider() at
    > System.Data.Ole Db.OleDbConnect ion.Open() at
    > RepNetWeb.Event s.BindData() in
    > C:\projects\kuh ns\repIntranet\ repNetWeb\Pages \Events\Event
    > s.aspx.vb:line 47
    >
    > I am using the following code in
    >
    >
    > Sub BindData()
    > Dim ConnectionStrin g As String
    > = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" & _
    > Server.MapPath( "..\..\Files\dB \KBWEB.MDB")
    >
    > Dim QuerySQL As String = "SELECT * FROM KBEVENTS"
    >
    > Dim objConn As New OleDbConnection
    > (ConnectionStri ng)
    > Dim objCmd As New OleDbCommand(Qu erySQL, objConn)
    >
    > Try
    > objConn.Open()
    > dgEvents.DataSo urce = objCmd.ExecuteR eader()
    > dgEvents.DataBi nd()
    >
    > Catch ex As OleDbException
    > lblError1.Text = ConnectionStrin g
    > 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,[/color]


    Comment

    Working...