The ASP page code has been written, it is worth reference to the blog from Cuiwl

xiaoxiao2021-03-06  72

ASP Universal Patement Class 1, the properties of the class, this is an ASP universal paging class. You can use it to make the record integration page, of course, there are many paging classes and paged functions on the Internet. This page mainly has attributes and methods such as CONN, SQL, URL, FIELDLIST, Pagesize, Template, INIT, SHOW, CLOSE. 1.conn attribute: used to get a CONNECTION object that has been created. 2. SQL Property: According to the incoming SQL statement, automatically create the RecordSet object 3.pageSize property: Set the number of records of the record 4.FieldList property: If you need to display the data in the library, be sure to set this property. It is used to get the correct field name that needs to be displayed. 5.url Attribute: Set the file address of the link in the sub-page bar. 6.Template Properties: Set the template of the paging file. 7.init Process: Page Class Initialization Data. 8. SHOW process: Display data. 9.Close Process: Patenclass End All Codes Download II, Source Codes of Class (Inc_Clspage.ASP)

<% '/ *************************************************************** ** '* *' * Name: ASP PAGNATION CLASS * '* Author: cjj *' * Version: V2.8 * '* Time: 2004-01-16 *' * comFrom: http://www.blueidea.com / * '* HomePage: None (Maybe Soon) *' * NOTICE: You can use and modify it freeely, * '* But please Hold this item. *' * If you modify it what I hope you * '* can send a Mail for me. * '* *' *********************************************** ******* / '######### Declaring Variable ########' Defines the display type const sw_intshowCHINESE = 0 'Chinese characters, such as "Previous, next Page "const sw_intshownglish = 1 'English, such as" back, next "const sw_intshowcharacter = 2' special character 'Define data display type const sw_inthorizontalview = 0' horizontal roll const sw_intverticalView = 1 'vertical row 'Line display type Const SW_intShowBigBorder = 2' bold line Const SW_intShowSmallBorder = 1 'thin line Const SW_intShowNoBorder = 0' wireless 'title bar line display type Const SW_intTleSmallBorder = 1' thin line Const SW_intTleNoBorder = 0 'wireless' information display tab Location const sw_intpageinnone = 0 'does not display the page string const SW_INTPAGEINTOP = 1' At top display const sw_intpageinbottom = 2 'At the bottom display const sw_intpageinall = 3' on the top, the number of numbers of numbers of numbers displayed in the bottom display "const Sw_intshowpages = 10 '

SWPage Class Private SW_blnIsHaveRS, SW_strFields, SW_blnInConn, SW_intShowPagePos, SW_strShowWidth '######### initialize variables ########## SW_blnIsHaveRS = false' acquisition flag is set recording settings Fasle, no record is set Status SW_STRSHOWIDTH = "90%" 'default display width is 90% sw_strfields = "" SW_BLNINCONN = true "Create a connection internally, if set to false, create sw_intshowpagePos = sw_intpageinall' ********** ********************************* Type: class' purpose: to record columns set "****** ******************************************** Class Swpage 'declared private variable private sw_objrs, sw_objconn private sw_strsql, sw_strull, SW_strError, SW_strFormAction, SW_strHeadJS, SW_strFootJS Private SW_intPageSize, SW_intTleBDType, SW_intShowPageType, SW_intShowType Private SW_lngTotalPage, SW_lngTotalRecord, SW_lngPageNo Private SW_aryFldName, SW_aryFldNote, SW_aryFldWidth, SW_aryFldAlign, SW_aryFldLink Private SW_blnInit, SW_blnOpenRS, SW_blnConn, SW_blnPageSize, SW_blnFieldList, SW_blnGetURL, SW_blnShowType, SW_blnShowPageType, SW_blnTemplate ' ***************** ************************ The type: attribute 'Purpose: According to the information obtained, create a database connection' input: A_STRCONN: Data Type String ' Return: No '*************************************** Public Property Let Conn a_strConn) Dim strError SW_blnConn = false Set SW_objConn = CreateObject ( "Adodb.Connection") On Error Resume Next SW_objConn.Open a_strConn If Err.Number <> 0 Then strError = strError & "
create a Connection object failed" On Error Goto 0 if Trim (strerror) = ""

THEN SW_BLNCONN = True else sw_strerror = sw_strerror & " conn attribute: < / TD> "& vbrlf sw_strerror = sw_strerror &" " & strerror & " " & vbcrf end if) ************************************************** Type: Attribute 'Purpose: Set Or displays the SQL statement. 'Enter: a_strsql: SQL statement. 'Return: SQL statement.

'*************************************** Public property let sql (a_strsql) DIM strError SW_blnOpenRS = false SW_strSQL = a_strSQL 'to create a RecordSet object Set SW_objRS = CreateObject ( "adodb.RecordSet") On Error Resume Next SW_objRS.Open SW_strSQL, SW_objConn, 1,1 If Err.Number <> 0 Then strError = "
Recording set open failed "On Error Goto 0 if Trim (STRERROR) =" "" "# 336699" "# 336699" "Height =" "28"> SQL attribute: "& vbcrf sw_strerror = sw_strerror &" t t = "# ffffff"> "& strerror & " " & vbcrlf end if End profersty '***************************************** ******** 'Type: Properties' Purpose: Set the field name "of the data you want to display" Enter: a_strfldname: field name string, multiple fields with comma-separated 'Return: no' **** *********************************** Public property Let FieldList (a_strfldname) DIM STRERROR SW_BLNFIELDLIST = false if Trim (a_strfldname) <> "" "" "", ","), "),") Else Strerror = strerror & "
You must set the field name that you need to display, otherwise you cannot display data "End if if trim (strIrror) =" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""

True else sw_strerror = sw_strerror & " fieldList property: "& vbcrlf sw_strerror = sw_strerror &" "& strerror &" "& vbcrf end if End Property '*** *********************************************** 'Type: Properties' Purpose: Set or display each The number of records of the page. 'Enter: a_intpagesize: The number of records shown per page. 'Return: The number of records shown per page.

'************************************************* PUBLIC Property Let Pagesize (a_intpagesize) DIM strError 'pageSize acquisition failure flag SW_blnPageSize = false If Trim (a_intPageSize) = "" OR (Not (IsNumeric (a_intPageSize))) Then strError = strError & "
illegal pagesize" Else If (a_intPageSize <= 2147483647 And a_intPageSize> = -2147483648) Then SW_intPageSize = CLng (a_intPageSize) Else strError = strError & "
PageSize overflow" End If If (SW_intPageSize <= 0) Then strError = strError & "
PageSize can only be a positive integer" End If End If IF TRIM (STRERROR) = "" THEN SW_BLNPAGESIZE = true else sw_strerror = sw_strerror & "t" "" # 336699 "" Height = "" 28 "> Pagesize Properties: "& vbcrlf sw_strerror = sw_strerror &" "& strerror &" "& Vbcrlf end if End Prop Erty '***************************************' Type: Property 'purpose: Set the paging file to display template information. 'Enter: a_strtemplate: Template description. 'Return: None.

'************************************************* Public property let template (A_STRTEMPLATE) DIM aryTemplate, i, j, strError, strTemp, intItem, aryTemp, aryTemp1 SW_blnTemplate = false aryTemplate = Split (Trim (LCase (a_strTemplate)), " ") intItem = UBound (aryTemplate) If intItem <4 Then strError = "
This property is a must INTEMP = TRIM (Arytemplate (0)) ifTRTEMP (0)) if strtemp = trim (AryTemp, 6), "[file =") = 0 THEN SW_STRHEADJS = "