asp里表格的循环

来源:百度知道 编辑:UC知道 时间:2024/05/27 06:12:08
在一空白中要每行最多三个单元格,单元格里的内容要从数据库中取出

<table width="100%">
<tr>

<%
a=0
cols=3
do while not rs1.eof
if a mod cols=0 then response.Write("<tr >")
a=a+1
%>
<td width="17"><%set rs5=server.createobject("adodb.recordset")
rs5.open "select id,cata4id,name from cata5 where cata4id="&rs4("id")&" ",conn,1,1
if not rs5.eof then
do while not rs5.eof%></td>
<td width="21"><img src="images/fbob02.gif" width="15" height="14"></td>
<td width="599"><a href="product.asp?cata5id=<%=rs5("id")%>"><%=rs5("name")%></a>
<%rs5.movenext
loop
rs5.close
end if
%> </td>
&l

仅从这段代码分析,下面这段:
<%
a=0
cols=3
do while not rs1.eof
if a mod cols=0 then response.Write("<tr >")
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对应.

问题表述不太清楚,HI me

<!--#include file="conn.asp"-->
<!--#include file="admin_yz.asp"-->
<%
if session("Login")=false then
Response.Redirect("index.asp")
end if
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="asp 表格的循环,急求救!! asp循环输出表格的问题 ASP表格循环 ASP表格循环问题 asp表格循环问题 asp循环输出表格问题 ASP种表格循环问题 如何定义ASP循环表格 ASP循环里的小小问题~!! 在asp里让一个一个表格(table)按顺序一行三个 第四个转下行 循环....