我问了三天都没人能解答的问题
<!--#include file=conn.asp-->
<%
sq= "select top 12 * from ad where gy_true <> 0 "
set rs=server.createobject( "adodb.recordset ")
rs.open sq,conn,1,1
%>
<div align= "center ">
<table width= "100% " height= "100 ">
<%if i mod 6=0 then%>
<tr>
<%end if%>
<%do while not rs.eof%>
<td align=center width=160 height=50> nothing to say </td>
</td>
<%if i mod 5 =0 then%>
</tr>
<%end if%>
<%
rs.movenext
i=i+1
loop
%>
</table>
</div>
首先我这代码是有错误的,只有i mod 6=0时才存在 <tr> 其他时候不存在 我想实现的是 当一行达到6列就换行
------解决方案--------------------改了一下,你参考
<div align= "center ">
<table width= "100% " height= "100 " border= "1 ">
<%
dim i
i=0
do while not rs.eof%>
<tr>
<%do while i <6 and not rs.eof%>
<td> <%=rs( "num ")%> </td>
<%rs.movenext
i=i+1%>
<%loop%>
</tr>
<%
i=0
loop%>
</table>
</div>
------解决方案-------------------- <!--#include file=conn.asp-->
<%
sq= "select top 12 * from ad where gy_true <> 0 "
set rs=server.createobject( "adodb.recordset ")
rs.open sq,conn,1,1
%>
<div align= "center ">
<table width= "100% " height= "100 ">
<tr>
<%
i=0
do while not rs.eof
%>
<td align=center width=160 height=50> <%=i%> </td>
<%
if i mod 6 =0 then
%>
</tr> <tr>
<%
end if
rs.movenext
i=i+1
loop
%>
</tr>
</table>
</div>