Paging Modular Paging
1. Query statement block
<%
Get the current file name
temp = Split (Request. ServerVariables ("URL"), "/"
FY = temp (UBound (temp))
Set Rs=server.createobject ("Adodb.recordset")
If not IsEmpty (Request ("page") Then
Pagecount=cint (Request ("page")
Else
Pagecount=1
End If
Sql= "SELECT query Statement"
Rs.Open sql,conn,1,1
rs.pagesize=10 Number of paging records
If Pagecount>rs.pagecount or pagecount<=0 then
Pagecount=1
End If
If Rs.eof and Rs.bof then%>
<div align= "center" class= "001" ><br>
Sorry, no records match the search criteria! <br>
</div>
2. Display a block of records
<%
Else
Rs. Absolutepage=pagecount
Do as not rs.eof%>
The records displayed
<% i=i+2
Rs.movenext
If I>=rs. PageSize then Exit Do
Loop
%>
3.
Paging effect
<table width= "778" border= "0" align= "center" cellpadding= "0" cellspacing= "0" >
<TR align= "center" >
<% if Rs.pagecount=1 then%>
<TD height= colspan= "4" Class=001><font color= "#000000" > Total [<font color= "#ff0000" ><%= RS.RECORDCOUNT%></FONT>] The message currently displays the first <font color= "red" >1~<%=rs.recordcount%></font> strips </ Font></td>
</tr>
<tr>
<%else%>
<TD width= "19%" height= align= "center" valign= "middle" class=001><font color= "#000000" >
<% page_start= (pagecount-1) *rs.pagesize
If Pagecount=1 then page_start=1
Page_end=rs.pagesize*pagecount
If Pagecount*rs.pagesize=>rs.recordcount then Page_end=rs.recordcount end if%>
Total [<font color= "#ff0000" ><%=RS.RECORDCOUNT%></FONT>] Information </font></td>
<TD width= "58%" height= align= "center" class= "FY" ><font color= "#000000" >
<%
If Pagecount>5 and pagecount< Rs. PageCount-5 and Rs.pagecount>10 Then
Qizu=pagecount-4
Min=pagecount+5
Response.Write "<a href=" &source& "page=1&sortid=" &sortid& "&typeid=" &typeid& " &qylb= "&qylb&" &title= "&title&" &cityid= "&cityid&" ><font color= ' 0000BE ' > Home </font></a> "
Response.Write "<a href=" &source& "page=" +cstr (pagecount-1) + "&sortid=" &sortid& "& Typeid= "&typeid&" &qylb= "&qylb&" &title= "&title&" &cityid= "&cityid&" ><font color= ' 0000BE ' > prev </font></a>
For Ipage=qizu to Min
If Ipage<>pagecount Then
Response.Write "<a href=" &source& "page=" +cstr (ipage) + "&sortid=" &sortid& "&typeid=" &typeid& "&qylb=" &qylb& "&cityid=" &cityid& "><font color= ' 0000BE ' >" +cstr ( IPage) + "</font></a>"
Else
Response.Write "<font color= ' #FF0000 ' >" &ipage& "</font>"
End If
Next
Response.Write "<a href=" &source& "page=" +cstr (pagecount+1) + "&sortid=" &sortid& "& Typeid= "&typeid&" &qylb= "&qylb&" &title= "&title&" &cityid= "&cityid&" ><font color= ' 0000BE ' > Next </font></a> "
Response.Write "<a href=" &source& "? page=" +cstr (Rs. PageCount) + "&sortid=" &sortid& "&typeid=" &typeid& "&qylb=" &qylb& "&title=" &title& "&cityid=" &cityid& "><font color= ' 0000BE ' > Last <