国产探花免费观看_亚洲丰满少妇自慰呻吟_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)
'打開記錄集
www.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>
<!-- /產品分頁表格 -->
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 丹江口市| 满洲里市| 乌拉特前旗| 黔西县| 苗栗市| 喀什市| 砀山县| 凤山市| 介休市| 南江县| 介休市| 西藏| 渭南市| 乡宁县| 珲春市| 从江县| 广州市| 永城市| 三明市| 北宁市| 舞钢市| 灵寿县| 西平县| 克什克腾旗| 格尔木市| 定日县| 万州区| 仁寿县| 景宁| 施甸县| 湖口县| 修武县| 丰顺县| 惠州市| 子洲县| 邛崃市| 丽江市| 遂昌县| 桂东县| 白水县| 玉屏|