This is just an ASP tip class thing, although it is suitable for each of the different file names call this function, but there are prerequisites, let's take a closer look at the story.
The following section is the basic page-splitting code:
<% sql = "Select ... ..... ........... The SQL statement
Set rs=server.createobject ("ADODB") is omitted. RECORDSET ")
Rs. Open SQL, Conn, 1, 1
if not rs.eof then
pages = 30 ' Define the number of records per page
rs.pagesize = Pages ' defines the number of records displayed per page
ALLP ages = Rs.pagecount ' calculates how many pages page
= request.querystring ("page") ' through the browser ' page
' if statement is a basic error-handling
if IsEmpty (p Age) or Cint (page) [1 then
page = 1
elseif Cint (page) > allpages then
page = Allpages end
I F
Rs. AbsolutePage = page
do, not rs.eof and pages > 0%>
Here's what
you want to do ... and so on. <% pages = Pages-1
Rs. MoveNext
Loop
Else
Response.Write ("Database Not content!") ") End
if
Rs. Close
Set rs = Nothing%>
The system has been paging the data, and here's a look at the key issues of this discussion the definition of paging function
<% SUB pageurl (PURL)
Dim eurl
txts = Request.ServerVariables ("URL")
txts = Left (Txts,instrrev (txts, "/", Len (txts))-1
eurl = "http://" & Request.ServerVariables ("SERVER_NAME") & txts for
i =1 to allpages
TXT = "" txt = "
" txt = txt & ""
If i = Cint (page) then txt = txt & " txt = txt &" ∥
Response.Write (TXT) Next end Sub%>
Save the page function code copy as an ASP file, and use include in the page you want to use to bring in the call ("/the filename you called?"). OK, like the one on my news page is called <%call ("/news.asp?") %>
There's a limit to what we've been up to . it means that in the first code, in addition to the SQL query content and output can be changed, other declarations Recordset objects, page, pages, allpages these variables can not be changed, otherwise it will not run ~ In fact, this program is irrelevant, the most important thing is that this paging function can be called in any ASP leaf.
Pagination do not very beautiful, experts can modify the changes, learn from each other!