65纳米最好的cpu:这个代码请问是哪里出错了?

来源:百度文库 编辑:查人人中国名人网 时间:2024/04/28 20:41:32
<!--#include file="../inc/include.asp" -->
<html>
<head>
</head>
<body>
<div align="center">
<table border="0" width="760" cellspacing="0" cellpadding="0" height="104" bgcolor="#FFFFFF">
</td>
</tr>
<tr>
<td align="center" height="23" width="28" bgcolor="#00AEEF">

<img border="0" src="images/S_DOWN.gif" width="11" height="11"></td>
<td align="center" height="23" background="images/classbg.gif" width="732">

<p align="left"><b>最新收录</b></td>
</tr>
<tr>
<td align="center" width="760" colspan="2" bgcolor="#F3F3F3">
<%
set rs1=server.createobject("adodb.recordset")
sql="select id,urlname,urlinfo,urlvalue,urltype from urls where urltype=1 order by id desc"
rs1.open sql,conn,1,1
if rs1.recordcount=0 then
response.write "<img border='0' src='images/sorry.gif' width='32' height='32'>对不起,没相关内容!"
else
%>
<table border="0" width="71%" cellspacing="0" cellpadding="0" id="table1" height="61">
<tr>
<td align="left" width="168" height="30" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #000000">
<font size="4" color="#1065C2">站名</font></td>
<td align="left" height="30" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #000000">
<font size="4" color="#1065C2">地址</font></td>
<td align="right" width="128" height="30" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #000000">
<font size="4" color="#1065C2">类别</font></td>
</tr>

<%
for i=1 to 30
%>
<tr>
<td width="168" align="left" height="25" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px dotted #C0C0C0">
<a target="_blank" title=<%=rs1("urlinfo")%> href="../url/id/zb168_id_<%=rs1("id")%>.htm"><%=rs1("urlname")%></a></td>
<td align="left" height="25" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px dotted #C0C0C0"><a target="_blank" title =<%=rs1("urlinfo")%> href="../url/id/zb168_id_<%=rs1("id")%>.htm"><%=rs1("urlvalue")%></a></td>
<td align="right" height="25" width="128" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px dotted #C0C0C0">
<p>
<%
set rs2=server.createobject("adodb.recordset")
sql1="select kindname2,kindid2 from kinds2 where classid=0"
rs2.open sql1,conn,1,1

%>

<a href="&rs2("url2")&"><%=rs2("kindname2")%></a></td>
</tr>
<%
rs1.movenext
if rs1.eof then exit for
next
rs2.close
set rs2=nothing
rs1.close
set rs1=nothing
end if
%>
</table>
</td>
</tr>
</table>
</div>
</body>

</html>

RS1 和 RS2的循环套住了
<%
rs1.movenext
if rs1.eof then exit for
next
rs2.close
set rs2=nothing
rs1.close
set rs1=nothing
end if
%>
这里面应该先对RS2操作完成后再进行RS1的操作

并且不应该使用FOR语句用于数据库操作

在你的循环中没有关闭RS2循环后又继续打开RS2就会造成错误!