zoukankan      html  css  js  c++  java
  • asp通用分页函数

     1<%dim rs3,pm3,bg
     2page=clng(request("page"))
     3set rs3 = server.createobject("adodb.recordset")
     4sql3 = "select distinct brlword from userinfo where bfenshuduan='"&key&"' order by brlword"
     5rs3.open sql3,conn,1,1
     6if rs3.eof then
     7%>
     8    <tr>
     9      <td width="580" colspan="5">
    10    <p align="center"><font color="#FF0000">对不起,没有符合条件的高校!</font>
    11
    12      </td>
    13    </tr>
    14    <tr>
    15     <td width="580" colspan="5">
    16<else %>
    17<%
    18const maxperpage=1
    19dim currentpage
    20rs3.pagesize=maxperpage
    21currentpage=request.querystring("pageid")
    22if currentpage="" then
    23currentpage=1
    24elseif currentpage<1 then
    25currentpage=1
    26else
    27currentpage=clng(currentpage)
    28    if currentpage > rs3.pagecount then
    29    currentpage=rs3.pagecount
    30    end if
    31end if
    32
    33if not isnumeric(currentpage) or currentpage="" then
    34currentpage=1
    35end if
    36dim totalput,n
    37totalput=rs3.recordcount
    38if totalput mod maxperpage=0 then
    39n=totalput\maxperpage
    40else
    41n=totalput\maxperpage+1
    42end if
    43if n=0 then
    44n=1
    45end if
    46rs3.move(currentpage-1)*maxperpage
    47i=0
    48do while i< maxperpage and not rs3.eof
    49        %>
    50        <tr>
    51        <td><%=getschoolinfo(rs3("brlword"),1)%></td>
    52        <td><%=getschoolinfo(rs3("brlword"),2)%></td>
    53        <td><%=getschoolinfo(rs3("brlword"),5)%></td>
    54        <td><%=getschoolinfo(rs3("brlword"),3)%></td>
    55        <td><%=getschoolinfo(rs3("brlword"),4)%></td>
    56      </tr>
    57<%                                                                         
    58i=i+1                                                      
    59rs3.movenext                                                        
    60loop                                                                                 
    61                                    
    62%>   
    63    </table>
    64<p align="center">页数:<%=currentpage%>/<=n%>                                                       
    65       <%k=currentpage                                                                                
    66       if k<>1 then%>                                                            
    67       <a href="picitop2.asp?pageid=1">首页</a>                                                                                
    68       <a href="picitop2.asp?pageid=<%=k-1%>&key=<%=key%>">上一</a>                                                                                
    69       <%else%>                                                            
    70       首页 上一页                                                                                
    71       <%end if%>                                                            
    72       <%if k<>then%>                                                                                
    73       <a href="picitop2.asp?pageid=<%=k+1%>&key=<%=key%>">下一</a>                                                                                
    74       <a href="picitop2.asp?pageid=<%=n%>&key=<%=key%>">尾页</a>                                                                                
    75       <%else%>                                                            
    76       下一页 尾页                                                                                
    77       <%end if%>                                                            
    78     共为您找到<font color="red"><%=totalput%></font>所高校
    79 
  • 相关阅读:
    WPF Caliburn 学习笔记(五)HelloCaliburn
    MSDN 教程短片 WPF 20(绑定3ObjectDataProvider)
    MSDN 教程短片 WPF 23(3D动画)
    比赛总结一
    HDU3686 Traffic Real Time Query System
    HDU3954 Level up
    EOJ382 Match Maker
    UESTC1565 Smart Typist
    HDU3578 Greedy Tino
    ZOJ1975 The Sierpinski Fractal
  • 原文地址:https://www.cnblogs.com/icejd/p/190053.html
Copyright © 2011-2022 走看看