Professional Web Applications Themes

Cannot connect database - ASP Database

Hi I trying some pretty basic web-enabled database stuff but I can't seem to get past the first hurdle. Tools - Windows 2000 professional - IIS 5.0 - Microsoft Access 2000 - Microsoft FrontPage 2000 I've created a new ASP file and added code to read the database. However, when I try to run the page in a browser, I'm met with the following error: Error Type: Microsoft OLE DB Service Components (0x80040E73) Format of the initialization string does not conform to the OLE DB specification. /patents.asp, line 16 Page: GET /patents.asp Snippet of the code I'm running is: openStr ...

  1. #1

    Default Cannot connect database

    Hi

    I trying some pretty basic web-enabled database stuff but
    I can't seem to get past the first hurdle.

    Tools - Windows 2000 professional
    - IIS 5.0
    - Microsoft Access 2000
    - Microsoft FrontPage 2000

    I've created a new ASP file and added code to read the
    database. However, when I try to run the page in a
    browser, I'm met with the following error:

    Error Type:
    Microsoft OLE DB Service Components (0x80040E73)
    Format of the initialization string does not conform to
    the OLE DB specification.
    /patents.asp, line 16

    Page:
    GET /patents.asp

    Snippet of the code I'm running is:

    openStr = "driver={Microsoft Access Driver (*.mdb)];" &
    "dbq=" & Server.MapPath("Patents
    Final_03_10_04.mdb")
    Set cn = Server.CreateObject("ADODB.Connection")
    cn.Open openStr
    sql = "SELECT txtPatentNo, txtGenericName" &_
    "FROM tbdPatents" &_
    "ORDER BY txtPatentNo; "
    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.Open sql, cn, 3, 3
    rs.Close
    set rs = Nothing
    cn.Close
    Set cn = Nothing

    I'm running the page through localhost and I've copied the
    ASP page and the database file to the correct folder but I
    still can't see what I'm doing wrong.

    Any help would be much appreciated.

    Thanx

    A-Face

    A-Face Guest

  2. #2

    Default Re: Cannot connect database

    A-Face wrote: 

    http://www.aspfaq.com/show.asp?id=2126

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"


    Bob Guest

  3. #3

    Default Re: Cannot connect database

    Thanx, I think that has half worked. When the page is run
    through C:\Inetpub\wwwroot\patents.asp, I get a blank
    page. When it's run through localhost/patents.asp, I get
    the same error.

    Very frustrating - any suggestions? [/ref]
    but 
    >
    >http://www.aspfaq.com/show.asp?id=2126
    >
    >--
    >Microsoft MVP - ASP/ASP.NET
    >Please reply to the newsgroup. This email account is my[/ref]
    spam trap so I 
    then remove the 
    A-Face Guest

  4. #4

    Default Re: Cannot connect database

    Huh?
    Are these different servers?

    A-Face wrote: 
    >>
    >> http://www.aspfaq.com/show.asp?id=2126
    >>
    >> --
    >> Microsoft MVP - ASP/ASP.NET
    >> Please reply to the newsgroup. This email account is my spam trap so
    >> I don't check it very often. If you must reply off-line, then remove
    >> the "NO SPAM"
    >>
    >>
    >> .[/ref][/ref]

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"


    Bob Guest

  5. #5

    Default Re: Cannot connect database


    "A-Face" <microsoft.com> wrote in message
    news:260301c4a9a4$79718530$gbl... 

    I think the ASP page only gets processed when you run it through
    localhost/..., since the IIS Server only gets involved in this case.
    Otherwise the content of the asp page is simply sent to the browser.
    So basically you still have the error.



     [/ref]
    > but 
    > >
    > >http://www.aspfaq.com/show.asp?id=2126
    > >
    > >--
    > >Microsoft MVP - ASP/ASP.NET
    > >Please reply to the newsgroup. This email account is my[/ref]
    > spam trap so I 
    > then remove the [/ref]


    Agoston Guest

  6. #6

    Default Re: Cannot connect database

    >> openStr = "driver={Microsoft Access Driver (*.mdb)];" &
    "dbq=" & Server.MapPath("Patents
    Final_03_10_04.mdb")

    Where did you get this format? I can see at least three problems:

    (a) driver={ and then you close with ] instead of } (learn to use copy and
    paste instead of reading and transcribing).
    (b) you should be using the JET/OLEDB drivers (see
    http://www.aspfaq.com/2126)
    (c) why does your MDB file name have spaces and date-specific information in
    it???

    Another thing: stop doing this:
     [/ref]
    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.Open sql, cn, 3, 3 [/ref]

    http://www.aspfaq.com/2191

    --
    http://www.aspfaq.com/
    (Reverse address to reply.)


    Aaron Guest

  7. #7

    Default Re: Cannot connect database

    Aaron

    What I'm trying to do is web-enable an Access database via
    ASP pages. I got all the code from a Microsoft book called
    Step-By-Step Web Database Development.

    The example used in the book uses a database called
    critters.mdb contained on a CD that comes with the book. I
    simply replaced references to their database with my own
    database.

    As for the database name and spaces, that's my fault -
    version control naming.

    I always assume that code from books is correct so I don't
    understand why they would print something like:
    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.Open sql, cn, 3, 3

    if it's an incorrect method?

    A-Face [/ref]
    > "dbq=" & Server.MapPath("Patents
    >Final_03_10_04.mdb")
    >
    >Where did you get this format? I can see at least three[/ref]
    problems: 
    (learn to use copy and 
    specific information in [/ref]
    >Set rs = Server.CreateObject("ADODB.Recordset")
    >rs.Open sql, cn, 3, 3 [/ref]
    >
    >http://www.aspfaq.com/2191
    >
    >--
    >http://www.aspfaq.com/
    >(Reverse address to reply.)
    >
    >
    >.
    >[/ref]
    A-Face Guest

  8. #8

    Default Re: Cannot connect database

    Agoston

    That clears up why running the page through
    C:\Inetpub\wwwroot\patents.asp gives me a blank page.
    There's only ASP code on the page so it's showing nothing
    Through localhost the ASP is running but incorrectly -
    hence the error.

    Thanks a lot

    A-Face 
    message [/ref]
    run 
    >
    >I think the ASP page only gets processed when you run it[/ref]
    through 
    this case. 
    the browser. 
    >> but [/ref][/ref]
    the [/ref][/ref]
    to [/ref][/ref]
    (*.mdb)];" & 
    >> spam trap so I 
    >> then remove the [/ref]
    >
    >
    >.
    >[/ref]
    Guest

  9. #9

    Default Re: Cannot connect database

    Bob

    No they're the same server. C:\Inetpub\wwwroot is the
    local path of my home directory which runs as localhost on
    the Net.

    A-Face [/ref]
    run [/ref][/ref]
    but [/ref][/ref]
    to [/ref][/ref]
    & [/ref][/ref]
    my spam trap so [/ref][/ref]
    line, then remove [/ref]
    >
    >--
    >Microsoft MVP - ASP/ASP.NET
    >Please reply to the newsgroup. This email account is my[/ref]
    spam trap so I 
    then remove the 
    A-Face Guest

  10. #10

    Default Re: Cannot connect database

    > I always assume that code from books is correct

    In general, that's a pretty funny statement. I own more books with errata
    than without.
     

    Ah, but I didn't say it was incorrect, did I? Did you read
    http://www.aspfaq.com/2191 ?

    --
    http://www.aspfaq.com/
    (Reverse address to reply.)


    Aaron Guest

Similar Threads

  1. how to connect database using asp?
    By Unregistered in forum Brainstorming Area
    Replies: 0
    Last Post: October 10th, 11:16 AM
  2. Can not connect to database
    By tomrippity02 in forum Coldfusion Database Access
    Replies: 3
    Last Post: April 7th, 05:19 AM
  3. How to use “RDS.Connect” to connect to a MS Access database?
    By hannaman@msn.com in forum ASP Database
    Replies: 0
    Last Post: August 2nd, 11:09 PM
  4. Connect to Web Database from VC++
    By Raghavendra in forum Microsoft SQL / MS SQL Server
    Replies: 0
    Last Post: July 16th, 06:11 AM
  5. connect to a database
    By Peter Morris in forum ASP
    Replies: 3
    Last Post: July 2nd, 12:32 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139