Error with ASP.NET opening OleDb/ODBC database

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Giuseppe D'Elia

    Error with ASP.NET opening OleDb/ODBC database

    Hi there,

    I got a problem using an MS Access database through
    ASP.NET.

    After updating my system from .NET Framework 1.0 to 1.1,
    my existing
    application gives me the following error when opening a
    connection
    with the code below:

    "Unspecifie d error" (ErrorCode: -2147467259)

    string connectionStrin gKey = "LocalDBConnect ionString";
    string connectionStrin g
    = "Provider=Micro soft.Jet.OLEDB. 4.0;Data
    Source=C:\InetP ub\wwwroot\IS_I taly_2003\IS.md b";

    OdbcConnection connection = new OdbcConnection
    (connectionStri ng);
    try
    {
    connection.Open ();
    }
    catch (OdbcException ex)
    {
    string error = ex.Message;
    }
    finally
    {
    connection.Clos e();
    }

    What's really strange is that:
    1. The same application works on some of my colleagues'
    computers with
    the .net Framework 1.1
    2. The very same code works on my computer when creating a
    brand new
    application with VS.NET 2003
    3. The same application was working with .NET Framework 1.0

    The same thing happens (including the two cases above)
    when using ODBC
    classes instead of OleDB ones. In this case the connection
    string is:

    "FIL=MS Access;DSN=AIS_ Local"

    and the error is:

    "ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]
    Disk or
    network error.\r\nERROR [IM006] [Microsoft][ODBC Driver
    Manager]
    Driver's SQLSetConnectAt tr failed\r\nERROR [HY000]
    [Microsoft][ODBC
    Microsoft Access Driver] Disk or network error."

    Need HELP!!!
    tks
  • Peter

    #2
    Error with ASP.NET opening OleDb/ODBC database

    Just to help with a little more info on what might be the
    same problem.

    Build web apps and services that run on Windows, Linux, and macOS using C#, HTML, CSS, and JavaScript. Get started for free on Windows, Linux, or macOS.

    tabindex=1&Post ID=225749

    I have the same problem that I can't access my mdb.
    I have enabled p/w on my db but this does not seem to work
    for me.

    If you solve the problem please post the solution.

    Peter
    [color=blue]
    >-----Original Message-----
    >Hi there,
    >
    >I got a problem using an MS Access database through
    >ASP.NET.
    >
    >After updating my system from .NET Framework 1.0 to 1.1,
    >my existing
    >application gives me the following error when opening a
    >connection
    >with the code below:
    >
    >"Unspecifie d error" (ErrorCode: -2147467259)
    >
    >string connectionStrin gKey = "LocalDBConnect ionString";
    >string connectionStrin g
    >= "Provider=Micro soft.Jet.OLEDB. 4.0;Data
    >Source=C:\Inet Pub\wwwroot\IS_ Italy_2003\IS.m db";
    >
    >OdbcConnecti on connection = new OdbcConnection
    >(connectionStr ing);
    >try
    >{
    >connection.Ope n();
    >}
    >catch (OdbcException ex)
    >{
    >string error = ex.Message;
    >}
    >finally
    >{
    >connection.Clo se();
    >}
    >
    >What's really strange is that:
    >1. The same application works on some of my colleagues'
    >computers with
    >the .net Framework 1.1
    >2. The very same code works on my computer when creating[/color]
    a[color=blue]
    >brand new
    >application with VS.NET 2003
    >3. The same application was working with .NET Framework[/color]
    1.0[color=blue]
    >
    >The same thing happens (including the two cases above)
    >when using ODBC
    >classes instead of OleDB ones. In this case the[/color]
    connection[color=blue]
    >string is:
    >
    >"FIL=MS Access;DSN=AIS_ Local"
    >
    >and the error is:
    >
    >"ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]
    >Disk or
    >network error.\r\nERROR [IM006] [Microsoft][ODBC Driver
    >Manager]
    >Driver's SQLSetConnectAt tr failed\r\nERROR [HY000]
    >[Microsoft][ODBC
    >Microsoft Access Driver] Disk or network error."
    >
    >Need HELP!!!
    >tks
    >.
    >[/color]

    Comment

    • Peter

      #3
      Error with ASP.NET opening OleDb/ODBC database

      Just to help with a little more info on what might be the
      same problem.

      Build web apps and services that run on Windows, Linux, and macOS using C#, HTML, CSS, and JavaScript. Get started for free on Windows, Linux, or macOS.

      tabindex=1&Post ID=225749

      I have the same problem that I can't access my mdb.
      I have enabled p/w on my db but this does not seem to work
      for me.

      If you solve the problem please post the solution.

      Peter
      [color=blue]
      >-----Original Message-----
      >Hi there,
      >
      >I got a problem using an MS Access database through
      >ASP.NET.
      >
      >After updating my system from .NET Framework 1.0 to 1.1,
      >my existing
      >application gives me the following error when opening a
      >connection
      >with the code below:
      >
      >"Unspecifie d error" (ErrorCode: -2147467259)
      >
      >string connectionStrin gKey = "LocalDBConnect ionString";
      >string connectionStrin g
      >= "Provider=Micro soft.Jet.OLEDB. 4.0;Data
      >Source=C:\Inet Pub\wwwroot\IS_ Italy_2003\IS.m db";
      >
      >OdbcConnecti on connection = new OdbcConnection
      >(connectionStr ing);
      >try
      >{
      >connection.Ope n();
      >}
      >catch (OdbcException ex)
      >{
      >string error = ex.Message;
      >}
      >finally
      >{
      >connection.Clo se();
      >}
      >
      >What's really strange is that:
      >1. The same application works on some of my colleagues'
      >computers with
      >the .net Framework 1.1
      >2. The very same code works on my computer when creating[/color]
      a[color=blue]
      >brand new
      >application with VS.NET 2003
      >3. The same application was working with .NET Framework[/color]
      1.0[color=blue]
      >
      >The same thing happens (including the two cases above)
      >when using ODBC
      >classes instead of OleDB ones. In this case the[/color]
      connection[color=blue]
      >string is:
      >
      >"FIL=MS Access;DSN=AIS_ Local"
      >
      >and the error is:
      >
      >"ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]
      >Disk or
      >network error.\r\nERROR [IM006] [Microsoft][ODBC Driver
      >Manager]
      >Driver's SQLSetConnectAt tr failed\r\nERROR [HY000]
      >[Microsoft][ODBC
      >Microsoft Access Driver] Disk or network error."
      >
      >Need HELP!!!
      >tks
      >.
      >[/color]

      Comment

      • John Toop

        #4
        Re: Error with ASP.NET opening OleDb/ODBC database

        Hi Peter, I had a similar problem with MSAccess. It was becasuse the ASPNET
        user (it seems this is the user that ASP.NET uses) did not have permissions
        to read/write ... in the directory I had chosen to place the file. I moved
        it into it's own directory and changed the permission to allow ASPNET to do
        anything and ... it worked.

        I'm using an XP machine. When I clicked on the properties for the folder,
        there was no security property. I had to change "folder options" in control
        panel away from "simple security" so that I could make this change. Then
        after I had it working, I changed "folder options" back to simple security
        and it's still working.

        That was what I did for my PC. Not necessarily the solution for you.

        "Peter" <peter@myresour ce.co.uk> wrote in message
        news:0b7801c351 db$c9aa8870$a40 1280a@phx.gbl.. .[color=blue]
        > Just to help with a little more info on what might be the
        > same problem.
        >
        > http://www.asp.net/Forums/ShowPost.aspx?
        > tabindex=1&Post ID=225749
        >
        > I have the same problem that I can't access my mdb.
        > I have enabled p/w on my db but this does not seem to work
        > for me.
        >
        > If you solve the problem please post the solution.
        >
        > Peter
        >[color=green]
        > >-----Original Message-----
        > >Hi there,
        > >
        > >I got a problem using an MS Access database through
        > >ASP.NET.
        > >
        > >After updating my system from .NET Framework 1.0 to 1.1,
        > >my existing
        > >application gives me the following error when opening a
        > >connection
        > >with the code below:
        > >
        > >"Unspecifie d error" (ErrorCode: -2147467259)
        > >
        > >string connectionStrin gKey = "LocalDBConnect ionString";
        > >string connectionStrin g
        > >= "Provider=Micro soft.Jet.OLEDB. 4.0;Data
        > >Source=C:\Inet Pub\wwwroot\IS_ Italy_2003\IS.m db";
        > >
        > >OdbcConnecti on connection = new OdbcConnection
        > >(connectionStr ing);
        > >try
        > >{
        > >connection.Ope n();
        > >}
        > >catch (OdbcException ex)
        > >{
        > >string error = ex.Message;
        > >}
        > >finally
        > >{
        > >connection.Clo se();
        > >}
        > >
        > >What's really strange is that:
        > >1. The same application works on some of my colleagues'
        > >computers with
        > >the .net Framework 1.1
        > >2. The very same code works on my computer when creating[/color]
        > a[color=green]
        > >brand new
        > >application with VS.NET 2003
        > >3. The same application was working with .NET Framework[/color]
        > 1.0[color=green]
        > >
        > >The same thing happens (including the two cases above)
        > >when using ODBC
        > >classes instead of OleDB ones. In this case the[/color]
        > connection[color=green]
        > >string is:
        > >
        > >"FIL=MS Access;DSN=AIS_ Local"
        > >
        > >and the error is:
        > >
        > >"ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]
        > >Disk or
        > >network error.\r\nERROR [IM006] [Microsoft][ODBC Driver
        > >Manager]
        > >Driver's SQLSetConnectAt tr failed\r\nERROR [HY000]
        > >[Microsoft][ODBC
        > >Microsoft Access Driver] Disk or network error."
        > >
        > >Need HELP!!!
        > >tks
        > >.
        > >[/color][/color]


        Comment

        Working...