Paging function

zhaozj2021-02-16  46

The function is as follows:

<% Private Function Fenye (RS, PageSize, Args) Dim Intcurdim INTPAGESIZEDIM TOTALDIM INTTOAL

Args = Split (Args, ") if Request.QueryString (" Page ") =" "INTCUR = 1 Page =" First "else SELECT CASE Request (" Page ") Case" first "intcur = 1 case" previous "INTCUR = CINT (Request (" curpage ") INTCUR = INTCUR-1 Case" Next "INTCUR = CINT (Request (" CURPAGE ")) INTCUR = INTCUR 1 CASE" Last "INTCUR = CINT (Request (" LastPage " ))) Else INTCUR = Request ("Page") End Select End IF%>

<% if qrs.eof kilite" No column: ("Else INTPAGESIZE = PageSize ket.pageSize = INTPAGESIZE IF NOTAL = = INTCUR End if Total = rs. Recordcount interttotal = rpagecount Dim i i = 0%> <% Dim N = 0 do while N <= ubound (args)%> <% DIM L = 0 do while l <= ubound (args)%>
<% response.write args (n)%> <% n = n 1 loop%> <% do while not qi ==EOF AND I
<% = rs (args (l))%> <

% L = L 1 LOOP%> <% i = i 1 rs.movenext loop%> <% end if%>


<% = INTCUR%> / <% = INTTOAL%> <% if INTCUR> 1 THEN%> Previous <% ELSE%> Previous <% end if INTCUR = CINT (INTCUR) INTTOTAL = CINT (InteTotal)%> <% if Intcur Next page <% else%> Next page <% end if%> <% rs.closset = Nothingend function% > The test page is as follows:

<% DIM conn number nextconnstr = "dbq =" server.mappath ("nwind.mdb") "; defaultdir =; driver = {Microsoft Access Driver (* .mdb)}; "SET CONN = Server.createObject (" AdoDb.Connection ") Conn.CreateObject (" AdoDb.Recordset ") Rst.Open" Select * from Orders " , CONN, 1, 1Call Fenye (RST, 7, "Orderid, Customerid, Shipvia) Rst.Closset Rst = NothingConnClosset Conn = Nothing%>

Description:

Add

Calling functions in a place to be paging: such as: Call Fenye (RST, 7, "Orderid, Customerid, Shipvia)

Function prototype: Variant Fenye (Recordset RS, Integer PageSize, String Args)

The parameters are as follows: RS: Incoming Recordsetn: Requires the number of records in each page, columns: the fields required to display the field

Doing such a paging function is because sometimes you write a paging, I feel that it is not so convenient. Every place is very wasting. I also saw that many friends are asking this question, so I wrote such a function. Let's take a look, first Write this kind of thing, I feel very low, but I hope everyone will hold. . . . . Thank you! ! ! Welcome all kinds of opinions and suggestions! By the way, this ADO's paging method, I think it is very efficient, because I will take a record set of hundreds or even thousands of records each time, if a server-side data is small. Ethere, if you are. . . . Ugh. . . So, will do a few different schematic paging functions in the future! My email: Xuchi@uibeonline.com

转载请注明原文地址:https://www.9cbs.com/read-27140.html

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