The most simplified paging program, attached to the source code.

xiaoxiao2021-03-06  24

PageTest.asp performance page <%

strsql = "SELECT * from authors"

SET RS = Server.createObject ("AdoDb.Recordset")

RS.Open Strsql, CONN, 1, 1

Set PageBase

Page.pageSize = 3

IF not isnumeric (Request ("page") ")") = 1) Then page.currentpage = 10 else page.currentpage = Request ("Page") End iFend IF

Page.LinkURL = "PageTest.asp"

Page.show (RS)

Page.fenye (RS)%>

Object.asp page object <%

'********************************** The *' * Nide's * '* mainly: Page classes. . . . . '*' * Coolwind qq: 1294420 '*' ******************************************

Class PageBasedim Pagesize 'Documentary DIM CURRENTPAGE' Each page DIM CURRENTPAGE 'Of course, DIM LINKURL' Dynamic URL

Sub show (ORS)

'Sub-programs displaying the page symbol ----------------------------------------------------------------------------------------------------------------- -------------------- i = 0 rs. & "
" i = i 1 Ors.movenext Loopend Sub "Show subroutines for paged symbols ------------------------- ------------------------------------

Sub Fenye (ORS)

Totalput = ips.recordcount pagesum = Totalput / Pagesize

'If it is the first page response.write "" & currentpage & "page / total" & pagesum & "page"

maxpage = 0 minpage = 0 if then minpage = currentpage-5 if (currentpage 4)> pagesum then maxpage = pagesum else maxpage = currentpage 4 end if else minpage = 1 if pagesum ((currentpage-5)> 1)> 10 Then maxpage = 10 else maxpage = Pagesum End (CINT (CURRENTPAGE-1)> 0) THEN IF (CINT (CURRENTPAGE-1)> CINT (PAGRENTPAGE-1)> CINT (PAGESUM)) THEN RESE.WRITE " << Previous "else response.write" << Previous "end if End if for i = minpage to maxpage if (cint (i) = cint (currentpage)) "[" & I & "]" else response.write "[ "& I &" ] "Endness"> 0) Then Response.write " Next >> "End if Response.write"
"The following is another paging display interface if currentpage = 1 Then Response.write" [Page] "Response.write" [Previous] "Else Response .Write "[ "[ Previous ] "endiff

'If it is the last page

IF CINT (CURRENTPAGE) ] "response.write" []" Else Response.write "[Next]" Response.write "[Last Page]" End ifend sund class%> conn.asp database link <% '******************************************* '*' * '* Connection to MSSQL Database' * '* CoolWind QQ: 1294420' * '************************************* ******* DIM CONN DIM CONNSTR = "provike = SQLOLEDB; DATA SOURCE = ServerName; UID = SA; PWD =; Database = PUBS;" SET CONN = Server.createObject ("AdoDb.Connection" IF ERR. Number <> 0 Then Err. Clear Set CONN = Nothing response.write "database connection error!" Response.end else conn.open conn = Nothing response.write "database connection error!" response. End end if End if%> Let's take a look, if you don't understand, ask me.


New Post(0)