PDA

Click to See Complete Forum and Search --> : Database error in Asp


thinh
Mar 14th, 2000, 09:37 AM
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

Serge
Mar 14th, 2000, 11:31 PM
Try somehting like this:


<%

'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

%>

thinh
Mar 15th, 2000, 10:03 AM
thank you serge....