Results 1 to 3 of 3

Thread: Database error in Asp

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 1999
    Location
    Garden Grove, CA, USA
    Posts
    110

    Post

    My source

    <%

    do
    if rs.EOF then
    rs.Close
    set rs = nothing
    set rs2 = nothing
    exit do
    end if
    Response.Write ("<BR><U><STRONG style='COLOR: red'>" & rs("Cat") & "<br>")
    sqlstmt = "select * from link where Cat = '" & rs("Cat") & "' ORDER BY Cat DESC "
    rs2.Open sqlstmt, Conn
    for x = 1 to rs2.RecordCount
    if rs2.EOF then
    sqlstmt = ""
    rs2.Close
    exit for
    end if
    Response.Write ("<TABLE border=1 cellPadding=1 cellSpacing=1 width='75%'>")
    Response.Write ("<TR><TD><a href='" & rs2("Url") & "'>" & rs2("Name") & "'</TD></TR></TABLE>")
    Response.Write ("<TABLE border=0 cellPadding=1 cellSpacing=1 width='90%'>")
    Response.Write ("<TR><TD style='HEIGHT: 20px; WIDTH: 5%' width='5%' height=20></TD>")
    Response.Write ("<TD>" & rs2("Desc") & "</TD></TR></TABLE><br>")
    rs2.MoveNext
    next
    rs.MoveNext
    loop

    %>

    It runs great with the first time in the rs2.open. but when it loop for the second time with rs2.open it gives me the following error...

    ADODB.Recordset error '800a0e79'

    The operation requested by the application is not allowed if the object is open.

    /linkview.asp, line 68



  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    Try somehting like this:

    Code:
    <%
    
    'I assume that you have rs open somewhere else...
    Do Until rs.Eof
        Response.Write ("<BR><U><STRONG style='COLOR: red'>" & rs("Cat") & "<br>")
        sqlstmt = "select * from link where Cat = '" & rs("Cat") & "' ORDER BY Cat DESC "
        rs2.Open sqlstmt, Conn
        Do Until rs2.EOF
            Response.Write ("<TABLE border=1 cellPadding=1 cellSpacing=1 width='75%'>")
            Response.Write ("<TR><TD><a href='" & rs2("Url") & "'>" & rs2("Name") & "'</TD></TR></TABLE>")
            Response.Write ("<TABLE border=0 cellPadding=1 cellSpacing=1 width='90%'>")
            Response.Write ("<TR><TD style='HEIGHT: 20px; WIDTH: 5%' width='5%' height=20></TD>")
            Response.Write ("<TD>" & rs2("Desc") & "</TD></TR></TABLE><br>")
            rs2.MoveNext
        Loop
        rs2.Close
        rs.MoveNext
    Loop
    
    %>

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 1999
    Location
    Garden Grove, CA, USA
    Posts
    110

    Thank you

    thank you serge....

Posting Permissions

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



Click Here to Expand Forum to Full Width