asp里表格的循环

2024-12-23 00:53:39
推荐回答(3个)
回答1:



<%
if session("Login")=false then
Response.Redirect("index.asp")
end if
%>





统计











<%set rs=server.createobject("adodb.recordset")
sql="select top 10 bianhao,fl from news order by bianhao desc"
rs.open sql,conn,1,3

do while not rs.eof
zongshu=zongshu+rs("bianhao")
rs.movenext
loop
rs.MoveFirst
do while not rs.eof%>



<%rs.movenext
loop
rs.close
set rs=nothing%>



<%=rs("bianhao")%>
px; background:url(gg.jpg) repeat-x bottom; width:30px; margin:5px auto; overflow: hidden">


<%=rs("title")%>




今日到账



<%set rs=server.createobject("adodb.recordset")
sql="select * from news order by bianhao desc"
rs.open sql,conn,1,3
do while not rs.eof%>






<%=rs("title")%> <%=rs("bianhao")%>

<%rs.movenext
loop
rs.close
set rs=nothing%>




回答2:

仅从这段代码分析,下面这段:
<%
a=0
cols=3
do while not rs1.eof
if a mod cols=0 then response.Write("")
a=a+1
%>

应该是rs4而不是rs1

还有,在rs4的循环中频繁打开关闭数据库,显得效率很低.你可以把rs4的sql语句贴出来,我想应该有更好解决的办法.

把if not rs5.eof then和end if去了,这两句在这里一点用处都没有,而且会起到坏效果,试想一下,假如rs5.eof为真,if体不会执行,rs5.close也不会执行,这时你的rs5就无法释放了.还有rs4.close 后面也有一个end if,不知这与哪个if对应.

回答3:

问题表述不太清楚,HI me