asp 一行显示2列 数据库循环

来源:百度知道 编辑:UC知道 时间:2024/06/18 09:39:01
<%
set rsSmallClass=server.CreateObject("adodb.recordset")
rsSmallClass.open "Select * From SmallClass_New Where BigClassName='" & owen1 & "' order by SmallClassID desc",conn,1,1
if not(rsSmallClass.bof and rsSmallClass.eof) then
do while not rsSmallClass.eof
%><tr onmouseover="this.bgColor='#FFFFFF';" onmouseout="this.bgColor='#EFEFEF';" bgColor=#EFEFEF>
<td height="28" ><div align="left"><a href="otype.asp?owen1=<%=owen1%>&owen2=<%=rsSmallClass("SmallClassName")%>">
  <%=rsSmallClass("SmallClassName")%></a></div></td>
</tr>
<%
rsSmallClass.movenext
loop
end if
rsSmallClass.close
set rsSmallClass=nothing
%>

请高人指点,一行两列循环读取数据库的值。谢谢

<%
set rsSmallClass=server.CreateObject("adodb.recordset")
rsSmallClass.open "Select * From SmallClass_New Where BigClassName='" & owen1 & "' order by SmallClassID desc",conn,1,1
if not(rsSmallClass.bof and rsSmallClass.eof) then%>
<tr onmouseover="this.bgColor='#FFFFFF';" onmouseout="this.bgColor='#EFEFEF';" bgColor=#EFEFEF>
<%do while not rsSmallClass.eof
dim i '建立一个变量i
i = i + 1 '每循环一次变量i的值就增加1
%>

<td height="28" ><div align="left"><a href="otype.asp?owen1=<%=owen1%>&owen2=<%=rsSmallClass("SmallClassName")%>">
<%=rsSmallClass("SmallClassName")%></a></div></td>
<%if i mod 2 = 0 then '当i除以2的余数为0时输出换下一行%>
</tr>
<tr onmouseover="this.bgColor='#