相關(guān)資訊
本類常用軟件
-
福建農(nóng)村信用社手機銀行客戶端下載下載量:584204
-
Windows優(yōu)化大師下載量:416896
-
90美女秀(視頻聊天軟件)下載量:366961
-
廣西農(nóng)村信用社手機銀行客戶端下載下載量:365699
-
快播手機版下載量:325855
本文章跟大家一起分享學習的是關(guān)于ASP橫向讀出數(shù)據(jù),一行列出三個記錄的實例教程,希望對正在學ASP的朋友們有所幫助。
方法一:
<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 %>
熱門評論
最新評論