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&PAGESQL&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
%>
<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>
<TR><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 ##-->