国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

分欄顯示記錄集的表格演示,并實現了分頁

2019-11-18 19:30:44
字體:
來源:轉載
供稿:網友
<!-- 本示例演示一個通用的記錄集分欄顯示,因為有的時候顯示產品等要每行顯示若干個,而不是每行顯示一個。如有有這種分欄顯示的表格,直接把下面的代碼套進去就行了,本示例是每行顯示2個記錄,再最下面還顯示了分頁欄。 -->
<%
'打開數據庫
Set conn = Server.CreateObject("ADODB.Connection")
strconn="Driver={sql server};server=localhost;database=northwind;uid=sa;pwd=sa;"
conn.Open strconn
'獲取本頁地址
Dim fileName,postion
fileName = Request.ServerVariables("scrpostion = InstrRev(fileName,"/")+1
fileName = Mid(fileName,postion)
'打開記錄集
m.survivalescaperooms.com
set rs=server.CreateObject("adodb.recordset")
rs.open "select titleofcourtesy,firstname,photopath from Employees order by employeeid desc",conn,1,1 
%>
<!-- 產品展示表格 -->
       <table width="90%" height="300"  border="0" align="center">
<%
if not(rs.bof and rs.eof) then
pages=4
rs.pagesize=pages
if not isempty(Request.QueryString("page")) then
 thispage=clng(Request.QueryString("page"))
else
 thispage=1
end if
rscount=rs.recordcount
if thispage="" then thispage=1
if thispage<1 then thispage=1
if (thispage-1)*pages>rscount then
 if (rscount mod pages)=0 then
  thispage=rscount/pages
 else
  thispage=rscount/pages+1
 end if
end if
if(rscount mod pages)=0 then
 allpages=rscount/pages
else
 allpages=rscount/pages+1
end if
rs.absolutepage=thispage
i=1
%>
                        <tr>
<%do while not rs.eof and  pages>0 %>
                          <td valign="top"><a href="<%=rs("PhotoPath")%>" target="_blank"><img src="<%=rs("PhotoPath")%>" alt="" width="100" height="100" border="0"></a><br>
                          <%=rs("titleofcourtesy")&rs("firstname")%> </td>
<%
'分欄主要由下面這個判斷來執行的,本例是每行顯示兩欄
if (i mod 2) =0 then
%>
      </tr><tr>
<%end if%>      
<%
pages = pages - 1
rs.movenext
i=i+1
loop
end if
%>
   
                      </table>
<!-- /產品展示表格 -->
<!-- 產品分頁表格 -->
                      <table width="90%"  border="0" align="center">
                        <tr>
                          <td> <center>
 共<%=allpages%>頁&nbsp;當前第<%= thispage %>頁&nbsp;
 <% if thispage<>1 then %>
 <a href="<%=filename&"?page=1"%>">首頁</a> <a href="<%=filename&"?page="&(thispage-1)%>">上頁</a>
 <% End If %>
 <% if thispage<>allpages then %>
  <a href="<%=filename&"?page="&(thispage+1)%>">下頁</a> <a href="<%=filename&"?page="&allpages&""%>">末頁</a>
  <% End If %>
  </center></td>
                        </tr>
                      </table>
<!-- /產品分頁表格 -->
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 定州市| 忻州市| 怀仁县| 开封县| 浮山县| 梁河县| 腾冲县| 南召县| 四平市| 云南省| 勐海县| 奈曼旗| 新郑市| 南澳县| 泸水县| 双牌县| 墨玉县| 新蔡县| 河池市| 金沙县| 福鼎市| 乌拉特后旗| 黄龙县| 安义县| 宿迁市| 靖边县| 牡丹江市| 巴彦淖尔市| 开原市| 五指山市| 桂阳县| 讷河市| 高碑店市| 太康县| 内江市| 临江市| 乌恰县| 铜陵市| 宣威市| 尼勒克县| 郴州市|