Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default newbie, ado issue

    i set up IIS and made a test asp script, that worked.
    I am trying to get some database connectivity, but I'm just not getting it.

    I copied to code straight from MS's Help file. (and made a few changes)
    for some reason i keep getting the following error:
    HTTP 500.100
    Error Type:
    ADODB.Recordset (0x800A0E7D)
    The connection cannot be used to perform this operation. It is either
    closed or invalid in this context.
    /Testproject1/Default.asp, line 21


    here is the code:

    <%@ Language=VBScript %>
    <HTML>
    <HEAD>
    <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
    </HEAD>
    <BODY>

    <P>test</P>
    <%
    'Establish a connection with data source.
    strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
    Source=C:\Inetpub\wwwroot\test.mdb"
    Set cnn = Server.CreateObject("ADODB.Connection")


    'Instantiate a Recordset object.
    Set rstListing = Server.CreateObject("ADODB.Recordset")

    'Open a recordset using the Open method
    'and use the connection established by the Connection object.
    strSQL = "SELECT fname, lname FROM book;"
    rstListing.Open strSQL, cnn

    'Cycle through record set and display the results
    'and increment record position with MoveNext method.
    Set objfname = rstListing("fname")
    Set objlname = rstListing("lname")
    Do Until rstListing.EOF
    Response.Write objfname & " " & objlnameame & "<BR>"
    rstListing.MoveNext
    Loop

    %>
    </BODY>
    </HTML>
    Dan Guest

  2. Similar Questions and Discussions

    1. Newbie Javascript issue
      I have a situation where rather than send an ID variable across as a url I'm trying to send it over as a form variable. (I know - that is probably...
    2. Actionscript newbie: simple stop issue
      Hello everyone. I'm trying to get a nested movie to stop playing when a 'stop' button is clicked. This movie is nested within two other movies,...
    3. Newbie ASP script issue
      Hi all, I have a problem with my ASP script below and the error message is: "The maximum amount of time for a script to execute was exceeded. ...
    4. Newbie Hello World Authentication Issue
      Hi... Real dumb question here, I'm sure: Setting up my first Hello World ASP.Net app...I can get it to run from the server machine that I am...
    5. Newbie Monitor Issue
      RedHat 9, ATI Radeon 7000 PCI, Shamrock 19" VESA monitor. Installation went very smooth. However, monitor goes black when loading firstboot. In...
  3. #2

    Default Re: newbie, ado issue

    strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
    Source=" & server.MapPath("test.mdb")
    Set cnn = Server.CreateObject("ADODB.Connection")


    Maarten Guest

  4. #3

    Default Re: newbie, ado issue

    On Fri, 16 Jul 2004 08:58:30 +0000, Maarten wrote:
    > strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
    > server.MapPath("test.mdb")
    > Set cnn = Server.CreateObject("ADODB.Connection")

    Gave that a try..
    strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
    server.MapPath("/TestProject1/test.mdb")

    i aslo tried just "test.mdb" , "/test.mdb"

    same thing


    d0x Guest

  5. #4

    Default Re: newbie, ado issue

    Dan wrote:
    > <%
    > 'Establish a connection with data source.
    > strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
    > Source=C:\Inetpub\wwwroot\test.mdb"
    > Set cnn = Server.CreateObject("ADODB.Connection")
    >
    >
    > 'Instantiate a Recordset object.
    > Set rstListing = Server.CreateObject("ADODB.Recordset")
    >
    > 'Open a recordset using the Open method
    > 'and use the connection established by the Connection object.
    You have to open the connection first ...


    cnn.open strConnectionString

    > strSQL = "SELECT fname, lname FROM book;"
    > rstListing.Open strSQL, cnn
    >
    Bob Barrows
    --
    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 Barrows [MVP] Guest

  6. #5

    Default Re: newbie, ado issue

    Bob Barrows [MVP] wrote:
    > Dan wrote:
    >
    >
    >><%
    >> 'Establish a connection with data source.
    >> strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
    >>Source=C:\Inetpub\wwwroot\test.mdb"
    >> Set cnn = Server.CreateObject("ADODB.Connection")
    >>
    >>
    >> 'Instantiate a Recordset object.
    >> Set rstListing = Server.CreateObject("ADODB.Recordset")
    >>
    >> 'Open a recordset using the Open method
    >> 'and use the connection established by the Connection object.
    >
    >
    > You have to open the connection first ...
    >
    >
    > cnn.open strConnectionString
    >
    >
    >
    >> strSQL = "SELECT fname, lname FROM book;"
    >> rstListing.Open strSQL, cnn
    >>
    >
    >
    > Bob Barrows

    ah hah!

    who would think that one must open the door before he walks into the room...

    That did the trick, Thanks a bunch!!!
    Dan Guest

Posting Permissions

  • You may not post new threads
  • You may 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