Easy-Heart ASP Page class V1.0_asp classes

Source: Internet
Author: User
Tags database join
Easy-Heart ASP Page Class v1.0
Copy Code code as follows:

<%
Class Ex_splitpagecls
'==========================================================================
' Easy-Heart ASP Page Class v1.0
' Author: Yi Xin qq:343931221
' Personal website www.ex123.net www.bo56.com
' Demo Address: Www.ex123.net/show/page
' Reprint please keep this information
'==========================================================================
Dim ex_rs
Dim Ex_columns ' The field to extract
Dim ex_datafrom ' Data Table name
Dim Ex_strwhere ' Record Filter criteria
Dim ex_order ' SQL Sort
Dim Ex_idcount ' Total Records
Dim ex_pagesize ' Number per page
Dim Ex_pagecount ' Total Pages
Dim Ex_ids ' Get the ID to use on this page
Dim Ex_sql ' Constructed SQL statement
Dim ex_page ' Current Display page number
Dim ex_conn ' Database Join 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
' Property Assignment:
Public Property Let Letconn (str)
Ex_conn=str
End Property
' Property assignment: The field that the SQL statement is to query with a SELECT
Public Property Let Letcolumns (str)
Ex_columns=str
End Property
' Property assignment: The SQL Statement filter Criteria section takes where
Public Property Let Letwhere (str)
Ex_strwhere=str
End Property
' Property assignment: SQL statement data strap from
Public Property Let Letdatafrom (str)
Ex_datafrom=str
End Property
' Property assignment: SQL statement sort part with order by
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
' Property Assignment: Current page size
Public Property Let Letpage (str)
Ex_page=str
End Property
' Property Assignment: Primary table primary key field
Public Property Let Letid (str)
Ex_id=str
End Property
' Properties: Get total number of records
Public Property Get Getrscount
Getrscount=ex_idcount
End Property
' Properties: Get page Totals
Public Property Get Getpagecount
if (ex_idcount>0) then ' if the total number of records = 0, then do not process
if (ex_idcount mod ex_pagesize=0) Then ' if the total number of records is divided by the number of lines per page, = Total records per page +1
Ex_pagecount=int (ex_idcount/ex_pagesize) ' Get total pages
Else
Ex_pagecount=int (ex_idcount/ex_pagesize) +1 ' Get total pages
End If
Getpagecount=ex_pagecount
Else
Getpagecount=0
End If
End Property
' Properties: Get current page number
Public Property Get GetPage
Getpage=ex_page
End Property
' Get the ID you want to use 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 ' show 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 for
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
' Returns the recordset to use 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.