Practical Paging program code in ASP

Source: Internet
Author: User

Page=request ("page")
If page<> "" Then
P_absolutepage=cint (page)
Else
P_absolutepage=1
End If
Sql= "SELECT * FROM [Date]"
Set Rs=server.createobject ("Adodb.recordset")
Rs.Open sql,conn,1,1
p_pagesize=2
Rs.pagesize=p_pagesize
Rs.absolutepage=p_absolutepage
P_pagecount=rs.pagecount
If P_pagecount=0 then p_pagecount=1
P_recordcount=rs.recordcount

<div align= "Right" >
<%if p_absolutepage<2 then%>
<span class= "page" title= "first page" > first page </span>
<span class= "page" title= "previous" > Prev </span>
<%else%>
<a href= "<%=filename%>?page=1" ><span class= "page" title= "first" > first page </span></a>
<a href= "<%=filename%>?page=<%=p_absolutepage-1%>" ><span class= "page" title= "prev" > previous page < /span></a>
<%end if%>
<%if p_pagecount-p_absolutepage<1 then%>
<span class= "page" title= "next Page" > next page </span> <span class= "page" title= "last Page" > last page </span>
<%else%>
<a href= "<%=filename%>?page=<%=p_absolutepage+1%>" >
<span class= "page" title= "Next" > next page </span></a>
<a href= "<%=filename%>?page=<%=p_pagecount%>" >
<span class= "page" title= "last Page" > last page </span></a>
<%end if%>
Page:<%=p_absolutepage%>/<%=p_pagecount%> page [Total <%=p_recordcount%> article][<%=p_pagesize%>/page]
</div>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.