Yixin ASP paging V1.0

Source: Internet
Author: User

Yixin ASP paging V1.0 CopyCode The Code is as follows: <%
Class ex_splitpagecls
'================================================ ==========================================
'Ease ASP paging type V1.0
'Author: Yixin QQ: 343931221
'Personal website www.ex123.net www.bo56.com
'Demo address: www.ex123.net/show/page
'Reprinted please keep this information
'================================================ ==========================================
Dim ex_rs
Dim ex_columns 'field to be extracted
Dim ex_datafrom 'data table name
Dim ex_strwhere 'record filtering Condition
Dim ex_order 'SQL sorting
Dim ex_idcount 'total number of records
Dim ex_pagesize 'number of entries per page
Dim ex_pagecount 'total number of pages
Dim ex_ids 'to obtain the ID used on this page
SQL statement constructed by dim ex_ SQL
Dim ex_page current page number
Dim ex_conn 'database connection object
Dim ex_index 'database record current location
Dim ex_id 'Primary key field
Private sub class_initialize
Set ex_rs = server. Createobject ("ADODB. recordset ")
Ex_id = "ID"
Ex_pagesize = 20
End sub
Private sub class_terminate
Ex_rs.close
Set ex_rs = nothing
End sub
'Attribute assignment:
Public property let letconn (STR)
Ex_conn = Str
End Property
'Attribute assignment: select is used for the fields to be queried in the SQL statement.
Public property let letcolumns (STR)
Ex_columns = Str
End Property
'Attribute assignment: the filter condition section of the SQL statement contains the WHERE clause.
Public property let letwhere (STR)
Ex_strwhere = Str
End Property
'Attribute assignment: the SQL statement data table includes the from
Public property let letdatafrom (STR)
Ex_datafrom = Str
End Property
'Attribute assignment: Order by is used for sorting SQL statements.
Public property let letorder (STR)
Ex_order = Str
End Property
'Attribute assignment: number of records per page
Public property let letpagesize (STR)
Ex_pagesize = Str
End Property
'Attribute assignment: Current page number
Public property let letpage (STR)
Ex_page = Str
End Property
'Attribute assignment: primary key field of the master table
Public property let letid (STR)
Ex_id = Str
End Property
'Property: Get the total number of records
Public property get getrscount
Getrscount = ex_idcount
End Property
'Properties: Get the total number of pages
Public property get getpagecount
If (ex_idcount> 0) then'
If (ex_idcount mod ex_pagesize = 0) then' if the total number of records is divided by the remainder of the number of entries per page, then = Total number of records/number of entries per page + 1
Ex_pagecount = int (ex_idcount/ex_pagesize) 'to obtain the total number of pages
Else
Ex_pagecount = int (ex_idcount/ex_pagesize) + 1' get the total number of pages
End if
Getpagecount = ex_pagecount
Else
Getpagecount = 0
End if
End Property
'Property: Get the current page number
Public property get getpage
Getpage = ex_page
End Property
'Get the ID to be used on this page
Private sub IDS
Dim I
Ex_ SQL = "select" & ex_id & "& ex_datafrom &" & ex_strwhere & "& ex_order
Ex_rs.open ex_ SQL, ex_conn, 1, 1
If not ex_rs.eof and not ex_rs.bof then
Ex_rs.pagesize = ex_pagesize 'number of records per page
Ex_rs.absolutepage = CINT (ex_page)
Ex_idcount = ex_rs.recordcount
If ex_page <1 then ex_page = 1
If ex_page> ex_pagecount then ex_page = ex_pagecount
If ex_pagecount> 0 then ex_rs.absolutepage = ex_page
For I = 1 to ex_rs.pagesize
If ex_rs.eof then exit
If (I = 1) then
Ex_ids = ex_rs ("ID ")
Else
Ex_ids = ex_ids & "," & ex_rs ("ID ")
End if
Ex_rs.movenext
Next
End if
Ex_rs.close
End sub
'Return the record set to be used on this page.
Public Function Execute
IDS
Ex_ SQL = ex_columns & "& ex_datafrom &" & ex_strwhere & "and ID in (" & ex_ids & ")" & ex_order
Ex_rs.open ex_ SQL, ex_conn, 1, 1
Set execute = ex_rs
End Function
End Class
%>
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.