Super ASP Oita page

Source: Internet
Author: User
Tags end query version
pagination | pagination <%
'===================================================================
' Showmorepage ASP version
' Version HuangJM1.00
' Code by Maomao
' Create Date 2004-09-28
' qq:5144707
' HTTP://BLOG.CSDN.NET/MAOMAOYSQ
' Write for my LOVER:HUANGJM ' This program is free to use, modify, but please keep the above information
'
' function
' This program is mainly to the data pagination part of the encapsulation, and the data display part completely by the user customization,
' Support URL multiple parameters: http://www.***.com/***.asp?aa=1&page=9&bb=2
'
'
' Paramers:
' Papgesize defines the number of records per page of pagination
' Getcurpagenum returns the number of recordsets on the current page This property is read-only
' Getrs Returns a paging recordset this property is read-only
' Getconn get a database connection
' GetSQL get the query statement
' Interface of Class
' ShowPage display the pager bar, the only common method
'
' ############ #类调用样例 #################
' Create object
' Set hjmpage=new showmorepage
' Get a database connection
' Hjmpage.getconn=conn
' SQL statement
' hjmpage.getsql= ' select * from Shop_books where newsbook=1 order by bookid Desc "
' Set the record bar data for each page to 20, the default display 10
' Hjmpage.pagesize=20
' Displays paging information, can be invoked anywhere, and can be invoked multiple times
' Hjmpage.showpage ()
' Set Rs=hjmpage.getrs () ' returns to the recordset
' Show data start
' Here's the way to customize the display.
The number of records for the current page of ' for I=1 to Hjmpage.getcurpagenum '
' Response.Write Left (Trim (RS ("BookName")) & "..."
' Rs.movenext
' Next
' Show Data End
' Set hjmpage=nothing
' ############ #类调用样例 #################
'===================================================================
Const btn_first= "<font face=" "Webdings" ">9</font>" defines the first-page button display style
Const btn_prev= "<font face=" "Webdings" ">3</font>" defines the previous-page button display style
Const btn_next= "<font face=" "Webdings" ">4</font>" defines the next-page button display style
Const btn_last= "<font face=" "Webdings" ">:</font>" defines the last-page button display style
Const xd_align= "Center" defines the alignment of pagination information
Const xd_width= "100%" Defines the paging information box size
Class Showmorepage
Private Obj_conn,obj_rs,str_sql,int_pagesize,str_errors,int_curpage,str_url,int_totalpage,int_totalrecord

'=================================================================
' PageSize Property
' Set the paging size of each page
'=================================================================
Public Property Let PageSize (Intvalue)
If IsNumeric (intvalue) Then
INT_PAGESIZE=CLNG (Intvalue)
Else
Str_errors=str_errors & "pagesize parameters are incorrect"
ShowError ()
End If
End Property
Public Property Get PageSize
If int_pagesize= "" or (Not (IsNumeric (int_pagesize)) Then
pagesize=10
Else
Pagesize=int_pagesize
End If
End Property
'=================================================================
' Getrs Property
' Returns a paginated recordset
'=================================================================
Public Property Get Getrs ()
If int_totalrecord= 0 then call GetPage ()
If not (obj_rs.eof and OBJ_RS.BOF) Then
If Int_curpage<>1 Then
If Int_curpage-1<int_totalpage Then
Obj_rs.move (int_curpage-1) *pagesize
Dim bookmark
Bookmark=obj_rs.bookmark
Else
Int_curpage=1
End If
End If
End If
Set getrs=obj_rs
End Property
'=================================================================
' Getcurpagenum Property
' Returns the number of recordsets on the current page
'=================================================================
Public Property Get Getcurpagenum ()
Dim int_pagenum
Int_pagenum = Int_pagesize
If int_totalrecord= 0 then call GetPage ()
If Int_curpage>int_totalpage Then
Int_curpage=int_totalpage
Int_pagenum = int_totalrecord-(int_totalpage-1) *int_pagesize
ElseIf Int_curpage=int_totalpage Then
Int_pagenum = int_totalrecord-(int_totalpage-1) *int_pagesize
End If
Getcurpagenum = Int_pagenum
End Property
'================================================================
' Getconn get a database connection
'
'================================================================
Public Property Let Getconn (sconn)
Set Obj_conn=sconn
End Property
'================================================================
' GetSQL get the query statement
'
'================================================================
Public Property Let GetSQL (svalue)
Str_sql=svalue
End Property

'==================================================================
' Initialization of the Class_Initialize class
' Initialize the value of the current page
'
'==================================================================



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.