Classic Paging Complete Program + Note

zhaozj2021-02-16  147

<% 'The following procedure is part of the programming technical article system in my website, highlighting the paging, so other useless code is cleared, you can modify the application' this page program full example, please log in http: // Www.lshdic.com's "Technical Articles" section View on Error Resume Next 'to prevent users from arbitrarily modifying the URL to cause errors if Request.QueryString ("Page") = "" "" "") = "" " ("Page") "The number of pages in the URL Page =?

Set link1 = server.createObject ("adoDb.connection") 'connection database link1.open "provider = microsoft.jet.oledb.4.0; data source =" & server.mappath ("Database 1.mdb") SET RS = Server .CreateObject ("AdoDb.Recordset") rs.open "Select * from Table 1", link1, 1, 1 'These definition records of cursors and recordings of each page and current page settings, very important rs.pagesize = 12rs.absolution = pageif err.Number <> 0 THEN 'prevented users from maliciously modifying URLs, and database-free error response.write "exception error" Response.Endend IF%>

<% for i = 0 to rs.pageSize-1' Displays the specific data content, i (Page * 13-13) 1 This solution is panelively after displaying the specific number IF RS.EOF kil1n exit forresponse.write "
" & i (Page * 13-13) 1 & ": & RS ("Author) &" "rs.movenextNext%>
<% Pagelen = Split (Request.String ") , "&") 'Get the URL? IF Ubound (Pagelen) <1 THEN' If the URL is XXX.ASP? Page = 1 or XXX.ASP Type of Standard Paging Method IF Page> 1 Then Response.write " Home Previous " : Else: RE Home Page "IF Page"

For i = 1 to rs.pagecountif i = page thrnecount.write i & ": else: response.write"

IF Page> 1 Then Response.write " Home Next page Last" ": Else: Response.write" next page "for i = 1 to rs.PageCountif i = Page Ten Response.write I &": Else: response.write " " NEXTEND IF' Pagelen (0) is equal to STR1 = Parameter 'Pagelen 1) equal to Page = 1rs.close 'Release Resource SET RS = NothingSet Link1 = Nothing%>


New Post(0)
CopyRight © 2020 All Rights Reserved
Processed: 0.042, SQL: 9