ASP High Performance Paging program

Source: Internet
Author: User
Tags sql
Program | paging | performance

<table width= "100%" border= "0" cellpadding= "0" cellspacing= "1" bgcolor= "#CCCCCC" >
<%
Sql= "Select ID from News order by ID Desc"
Sqla= "Select title,filepath,filename from News where ID"
sqlb= "ORDER by ID Desc"
Rs. Open sql,conn,1,1
Thepagecount=1
Currentpage=1
Topage=1
If not Rs. Eof Then
' # #分页处理开始
thepagesize=120
Rs. Pagesize=thepagesize
Thepagecount=rs. PageCount
Gettopage=request.querystring ("ToPage")
IF not IsNumeric (gettopage) or InStr (GetToPage, ".") Then
Rs. Absolutepage=1
Else
IF Cint (gettopage) <=1 Then
Topage=1
Rs. Absolutepage=1
ElseIF Cint (gettopage) >=thepagecount Then
Topage=rs. PageCount
Rs. Absolutepage=thepagecount
Else
Topage=gettopage
Rs. Absolutepage=gettopage
End IF
End IF
' # #分页处理结束
I=0
Pagelistnumber=0
Pagesql= "("
While not Rs. Eof and I<thepagesize
Pagesql=pagesql&rs (0) & ","
Rs. MoveNext
I=i+1
Pagelistnumber=pagelistnumber+1
Wend
Rsclose
pagesql=pagesql& "0)"
' Response.Write Pagesql

Set Rs=conn.execute (SQLA&AMP;PAGESQL&AMP;SQLB)
I=1
T=1
While not Rs. Eof
IF T mod 2=0 Then
Backgroundcolor= "FFFFFF"
Else
Backgroundcolor= "F7f7f7"
End IF

IF I=1 Then
Response.Write "<tr bgcolor=" "#FFFFFF" ">"
End IF
%>
&LT;TD height= "width=" 25% "> <a href=" Newscontent<%response.write rs (1) &rs (2)%> "Target=_blank ><%response.write RS (0)%></a></td>
<%
IF I mod 4 = 0 Then
T=t+1
Response.Write "</tr>"
End IF
IF (i mod 4 = 0) and i<>thepagesize Then
Response.Write "<tr bgcolor=" "#" &BackGroundColor& "" > "
End IF
IF (i mod 4 <>0) and I=pagelistnumber Then
For X=1 to ((I mod 4))
Response.Write "<td> </td>"
Next
Response.Write "</tr>"
End IF
I=i+1
Rs. MoveNext
Wend
Rs. Close
Set rs=nothing
Else

End IF
%>
</table>
<!--# page foreground display code snippet start ##-->
<table width=100%>
<form action= "" method=get>
&LT;TR&GT;&LT;TD height=40 Valign=middle align=center>
Total <%=ThePageCount%> Page | <a href =?id=<%=id%>> Home </a> |
<%if topage > 1 then%>
<a href =?id=<%=id%>&topage=<%=topage-1%>> prev </a>
<%Else%>
Previous page
<%end if%>
|
<%
Currentpage=cint (ToPage)
If Cint (topage) <cint (Thepagecount) Then
ToPage = Cint (topage) + 1
%>
<a href =?id=<%=id%>&topage=<%=topage%>> Next page </a>
<%Else%>
<font style= ' color: #999999 ' > Next page </font>
<%end if%>
| <a href =?id=<%=id%>&topage=<%=thepagecount%>> last </a> | <input type=text name= "ToPage" value= "<%=CurrentPage%>" size=4 maxlength=5 style= "Border-right:silver 1px Solid #aaaaaa; Border-top:silver 1px solid; Border-left:silver 1px solid; BACKGROUND-COLOR:FFFFFF; height:13pt;width:20pt; Color:black; Border-color: #aaaaaa; Border-bottom:silver 1px solid #aaaaaa; font-size:9pt; " > Page <input type=submit value= "Jump" style= "Border-right: #cccccc 1px groove; font-weight:normal;font-size:9pt; Height:14pt;line-height:normal; Border-bottom: #cccccc 1px groove; Font-style:normal; Background-color: #eeeeee; Font-variant:normal "></td></tr>
<!--hidden value transfer
<input type=hidden name= "" value= ">
Hidden value Transfer-->
<input type=hidden name= "ID" value= "<%=ID%>" >
</form>
</table>
<!--# page foreground display code snippet end ##-->



Related Article

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.