asp 一行显示2列 数据库循环
<%setrsSmallClass=server.CreateObject("adodb.recordset")rsSmallClass.open"Select*From...
<%
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
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='#FFFFFF';" onmouseout="this.bgColor='#EFEFEF';" bgColor=#EFEFEF>
<%
end if
rsSmallClass.movenext
loop%>
</tr>
<%end if
rsSmallClass.close
set rsSmallClass=nothing
%>
改过后循环输出的HTML只是TD单元格了,TR靠判断输出。好像笨了点,不过容易懂!
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='#FFFFFF';" onmouseout="this.bgColor='#EFEFEF';" bgColor=#EFEFEF>
<%
end if
rsSmallClass.movenext
loop%>
</tr>
<%end if
rsSmallClass.close
set rsSmallClass=nothing
%>
改过后循环输出的HTML只是TD单元格了,TR靠判断输出。好像笨了点,不过容易懂!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询