ASP嵌套循环的问题

happying2000 2010-05-01 03:40:46
<table border="0" cellspacing="5" cellpadding="0" width="400" height="120" id="mainTable">
<%rs.open "select * from ns2 where sjid=108 order by id asc",conn,1
if not rs.eof and not rs.bof then
a=0
while not rs.eof

if a=0 then
%>
<tbody style="display:block;" >
<%
else
%>
<tbody style="display:none;">
<% end if %>
<tr>
<td height="120">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<%
rst.open "select * from nm where ns2="&rs("id")&" order by id asc",conn,1
if not rst.eof and not rst.bof then
while not rst.eof
%>


<tr>
<td height="72">

</td>
</tr>
<%
rst.movenext
wend
' end if
rst.close%>

</table>
</td>
</tr>
</tbody>

<%
a=a+1
rs.movenext
wend
end if
rs.close%>

</table>

这个嵌套循环到底存在什么问题,为什么一运行就出现死循环的样子,而且w3wp进程cpu的占用率达到90以上,到底是怎么回事?
...全文
192 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
stianx 2010-05-04
  • 打赏
  • 举报
回复
<table border="0" cellspacing="5" cellpadding="0" width="400" height="120" id="mainTable">
<%rs.open "select * from ns2 where sjid=108 order by id asc",conn,1
if not rs.eof and not rs.bof then
a=0
while not rs.eof

if a=0 then
%>
<tbody style="display:block;" >
<%
else
%>
<tbody style="display:none;">
<% end if %>
<tr>
<td height="120">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<%
rst.open "select * from nm where ns2="&rs("id")&" order by id asc",conn,1
if not rst.eof and not rst.bof then
while not rst.eof
%>


<tr>
<td height="72">

</td>
</tr>
<%
rst.movenext
wend
end if
rst.close%>

</table>
</td>
</tr>
</tbody>

<%
a=a+1
rs.movenext
wend
end if
rs.close%>

</table>
leaddollar 2010-05-04
  • 打赏
  • 举报
回复
最好以代码形式发出来,这样直接帖代码好恼火。
l83203808 2010-05-02
  • 打赏
  • 举报
回复
帮顶 学习下
aiming_dai 2010-05-02
  • 打赏
  • 举报
回复
ddddddddddddddddddddddddddddddddd
猜我是几娃 2010-05-01
  • 打赏
  • 举报
回复
我感觉不像是循环上出了问题,而是在读数据库上出了问题
happying2000 2010-05-01
  • 打赏
  • 举报
回复
<table border="0" cellspacing="5" cellpadding="0" width="400" height="120" id="mainTable">
<%rs.open "select * from ns2 where sjid=108 order by id asc",conn,1
if not rs.eof and not rs.bof then
a=0
while not rs.eof

if a=0 then
%>
<tbody style="display:block;" >
<%
else
%>
<tbody style="display:none;">
<% end if %>
<tr>
<td height="120">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<%
rst.open "select * from nm where ns2="&rs("id")&" order by id asc",conn,1
if not rst.eof and not rst.bof then
while not rst.eof
%>


<tr>
<td height="72">

</td>
</tr>
<%
rst.movenext
wend
end if
rst.close%>

</table>
</td>
</tr>
</tbody>

<%
a=a+1
rs.movenext
wend
end if
rs.close%>

</table>

代码是这样的哈

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧