Access 2000 DB via DSN-Less ASP Connection...


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Access 2000 DB via DSN-Less ASP Connection...

  1. #1
    JimmyD Guest

    Access 2000 DB via DSN-Less ASP Connection...


    Hi there,
    For testing purposes, I have set up a simple db in Access 2000. I have also
    set up the same database in Access 97.

    Here is the code from the ASP that opens the connection:

    <%
    cst = "Driver={Microsoft Access Driver (*.mdb)};"
    cst = cst & "DBQ=" & server.mappath("sample.mdb")
    set conn = server.createobject("adodb.connection")
    conn.open cst
    %>
    <%
    set rs = Server.CreateObject("ADODB.RecordSet")
    query="select * from friends"
    rs.Open query, Conn
    %>

    If I use the Access 2000 version of sample.mdb with the above code, I get
    this error:
    Microsoft OLE DB Provider for ODBC Drivers error '80004005'

    [Microsoft][ODBC Microsoft Access 97 Driver] Can't open database '(unknown)'.
    It may not be a database that your application recognizes, or the file may
    be corrupt.

    /product.asp, line 14


    If I use the Access 97 version of the db, it displays the contents of the
    table without any problem.

    SO...what needs to change in the ASP code to recognize an Access 2000 db?
    I suspect that cst = "Driver={Microsoft Access Driver (*.mdb)};" is the
    main problem.

    Any thoughts would be great!
    JimmyD
    jdlug@isgteam.com

  2. #2
    Douglas J. Steele Guest

    Re: Access 2000 DB via DSN-Less ASP Connection...

    Check http://www.able-consulting.com/ado_conn.htm at Carl Prothman's site to
    make sure you have the right Connection string.

    --

    Doug Steele, Microsoft Access MVP
    Beer, Wine and Database Programming. What could be better?
    Visit "Doug Steele's Beer and Programming Emporium"
    http://I.Am/DougSteele/


    "JimmyD" <jdlug@isgteam.com> wrote in message
    news:3a6f156a$1@news.devx.com...
    >
    > Hi there,
    > For testing purposes, I have set up a simple db in Access 2000. I have

    also
    > set up the same database in Access 97.
    >
    > Here is the code from the ASP that opens the connection:
    >
    > <%
    > cst = "Driver={Microsoft Access Driver (*.mdb)};"
    > cst = cst & "DBQ=" & server.mappath("sample.mdb")
    > set conn = server.createobject("adodb.connection")
    > conn.open cst
    > %>
    > <%
    > set rs = Server.CreateObject("ADODB.RecordSet")
    > query="select * from friends"
    > rs.Open query, Conn
    > %>
    >
    > If I use the Access 2000 version of sample.mdb with the above code, I get
    > this error:
    > Microsoft OLE DB Provider for ODBC Drivers error '80004005'
    >
    > [Microsoft][ODBC Microsoft Access 97 Driver] Can't open database

    '(unknown)'.
    > It may not be a database that your application recognizes, or the file may
    > be corrupt.
    >
    > /product.asp, line 14
    >
    >
    > If I use the Access 97 version of the db, it displays the contents of the
    > table without any problem.
    >
    > SO...what needs to change in the ASP code to recognize an Access 2000 db?
    > I suspect that cst = "Driver={Microsoft Access Driver (*.mdb)};" is the
    > main problem.
    >
    > Any thoughts would be great!
    > JimmyD
    > jdlug@isgteam.com




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center