高手帮忙 asp 列循环问题

来源:百度知道 编辑:UC知道 时间:2024/05/15 15:11:54
问题1:现在是个2列循环,我想改成4列循环,需要怎么修改.
问题2:为什么现在2列循环中,第一个表格是空白的...

我只有5分了
<%
exec="select distinct publication from base"
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,1
%>

<table width="780" border="1" cellpadding="2" style="border-collapse: collapse" bordercolor="#808080" align=center>
<%
i=0
do while not rs.eof
if i mod 2 = 0 then
i=i+1
%>
<tr>
<td>
<%=rs("publication")%>
</td>
<%
else
i=i+1
%>
<td>
<%=rs("publication")%>
</td>
</tr>
<%
end if
rs.movenext
loop
%>
</table>

<table width="780" border="1" cellpadding="2" style="border-collapse: collapse" bordercolor="#808080" align=center>
<%
i=0
do while not rs.eof
if i = 0 Then
Response.Write "<tr>"
End If
%>
<td><%=rs("publication")%></td>
<%
i=i+1
If i=4 Then
i=0
Response.Write "</tr>"
End If
rs.movenext
loop
Set Rs=Nothing
%>
</table>