ASP横向读出数据,一行列出三个记录
来源:互联网 发布:app棋牌游戏源码 编辑:程序博客网 时间:2024/06/07 01:53
方法一:
<table width="100%" align="center">
<%for i=1 to rs.recordcount
if (i mod 3=1) then
response.write"<tr>"
end if
response.write"<td>"&rs("XXX")&"</td>"
if (i mod 3=0) then
response.write"</tr>"
end if
rs.movenext
next%>
</table>
代码一目了然,重点是第七行----if (i mod 3=0) then
这里是排成3列的,如果你想排成更多或更少,可自行修改。
方法二:
<%set rs=server.CreateObject("adodb.recordset")
SQL = "Select * From Shop_books Order By Adddate Desc"
rs.open SQL,conn,1,1
%>
<tr>
<td>
<table width="193" border="0" cellpadding="5" cellspacing="0">
<tr>
<% dim j
j=0
do while not rs.eof %>
<td width="193">
<table width="168" border="0" cellpadding="3" cellspacing="0">
<tr>
<td width="163"><a href=list03.asp?id=<%=rs("bookid")%>><img src="<%=trim(rs("bookpic"))%>" width="140" height="100" border="0" class="blue"></a></td>
</tr>
<tr>
<td valign="top"><a href="list.asp03?id=<%=Rs("bookid")%>" class="word-red13-bold"><%=Rs("bookname")%></a><br>
<%=Rs("bookcontent")%><br> <br> <span class="word-grey12"> 市场价:<%=Rs("shichangjia")%>元<br>
会员价:<%=Rs("huiyuanjia")%>元<br>
VIP价:<%=Rs("vipjia")%>元</span></td>
</tr>
<tr>
<td height="30">
<div align="right"></div>
<div align="right">
<table width="90%" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td><div align="right"><a href="gouwu.asp?id=<%=rs("bookid")%>&action=add"><img src="images/2_01.gif" width="46" height="20" border="0"></a>
<a href="shoucang.asp?id=<%=rs("bookid")%>&action=add"><img src="images/2_03.gif" width="46" height="20" border="0"></a>
</div></td>
</tr>
</table>
</div></td>
</tr>
</table>
</td>
<% rs.movenext
j=j+1
if rs.eof then
exit do
end if
if j>=3 then exit do
loop
'rs.close
'set rs= nothing %>
<table width="100%" align="center">
<%for i=1 to rs.recordcount
if (i mod 3=1) then
response.write"<tr>"
end if
response.write"<td>"&rs("XXX")&"</td>"
if (i mod 3=0) then
response.write"</tr>"
end if
rs.movenext
next%>
</table>
代码一目了然,重点是第七行----if (i mod 3=0) then
这里是排成3列的,如果你想排成更多或更少,可自行修改。
方法二:
<%set rs=server.CreateObject("adodb.recordset")
SQL = "Select * From Shop_books Order By Adddate Desc"
rs.open SQL,conn,1,1
%>
<tr>
<td>
<table width="193" border="0" cellpadding="5" cellspacing="0">
<tr>
<% dim j
j=0
do while not rs.eof %>
<td width="193">
<table width="168" border="0" cellpadding="3" cellspacing="0">
<tr>
<td width="163"><a href=list03.asp?id=<%=rs("bookid")%>><img src="<%=trim(rs("bookpic"))%>" width="140" height="100" border="0" class="blue"></a></td>
</tr>
<tr>
<td valign="top"><a href="list.asp03?id=<%=Rs("bookid")%>" class="word-red13-bold"><%=Rs("bookname")%></a><br>
<%=Rs("bookcontent")%><br> <br> <span class="word-grey12"> 市场价:<%=Rs("shichangjia")%>元<br>
会员价:<%=Rs("huiyuanjia")%>元<br>
VIP价:<%=Rs("vipjia")%>元</span></td>
</tr>
<tr>
<td height="30">
<div align="right"></div>
<div align="right">
<table width="90%" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td><div align="right"><a href="gouwu.asp?id=<%=rs("bookid")%>&action=add"><img src="images/2_01.gif" width="46" height="20" border="0"></a>
<a href="shoucang.asp?id=<%=rs("bookid")%>&action=add"><img src="images/2_03.gif" width="46" height="20" border="0"></a>
</div></td>
</tr>
</table>
</div></td>
</tr>
</table>
</td>
<% rs.movenext
j=j+1
if rs.eof then
exit do
end if
if j>=3 then exit do
loop
'rs.close
'set rs= nothing %>
- ASP横向读出数据,一行列出三个记录
- ASP横向重复显示记录
- asp中checkbox数据写入与读出
- SQL 将横向数据转为纵向记录
- ASP.NET sqlserver 数据转为横向显示
- [VB.NET]ADO数据库处理-读出数据记录
- winform开发,双击dataGridView中的一行数据,将数据读出显示。
- asp 判断数字 判断数据库读出来的数据 null
- ASP.NET读出XML数据生成Excel(转)
- ASP.NET 从xml读出数据时的分页方法
- Extjs EditorGridPanel的使用.(数据从后台读出) asp.net
- asp 源码,combox 三级联动,数据从ACCESS中读出
- 数据对比,列出数据修改、新增、删除记录
- 从数据库读出数据三个换行轮显出意外,请求解决
- 查字段指定数据后一行记录
- Servlet读出一条记录
- Scott Mitchell 的ASP.NET 2.0数据教程之三十一::使用DataList来一行显示多条记录
- Scott Mitchell 的ASP.NET 2.0数据教程之三十一::使用DataList来一行显示多条记录
- 4-7层新亮点
- petshop的缓存输出
- 用SQL语句删除表格
- 12月21号日记
- 基于ARM体系的嵌入式系统BSP的程序设计
- ASP横向读出数据,一行列出三个记录
- 分类说明
- 这两天身体有些不适
- Lilosoft.CoSpace 构件开发平台对外发布
- C语言中可变参数宏的深入讨论
- 利用 Visio 2003 连接在线数据
- SQL 语法参考手册
- 【转载】路由器的原理与作用
- 妈妈生病的日子