Common Data Paging classes

Source: Internet
Author: User
Tags table name
Universal paging class, which is much easier when you write pagination to display the data. Call this class directly, and then execute to get all the data for the current page.
The work done by this class is to get only the data for the current page, and the total number of pages and total records, and so on.
ASP code:
<%
'/***************************** pagination Display class **************************
'/* Author: wah-yu
'/* Date: November 18, 2004
'/* Function: Get a page of data and return to the external
'/* Description Example:
'/* Dim mypage=new Pageclass
'/* mypage.conn=conn ' Sets the Connection object
'/* mypage.pagesize=20 ' sets how many data is displayed on a page (default is 10)
'/* mypage.curpage=2 ' sets the current page number to display
'/*''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'/* mypage.tablename= ' member ' sets the table name
'/* mypage.fields= ' id,membername,memberpass ' Set display field List
'/* mypage.condition= ' id>100 ' Set query criteria
'/* mypage.orderby= ID DESC ' Set sort criteria (be sure to set this property)
'/* Set Pagers=mypage.execute ' returns the data (Recordset object) for the current 2nd page and returns Nothing if an error occurs
'/*''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
The definition of '/* ' can also be used in the following ways: Executeby (table name, field list, query criteria, sort criteria)
'/* Set Pagers=mypage.executeby ("member", "Id,membername,memberpass", "id>100", "ID DESC")
'/*''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'/* pagecount=mypage.pagecount ' returns the total number of page numbers
'/* recordcount=mypage.recordcount ' returns the total number of records
'/* nextpage=mypage.nextpage ' returns the page number of the next page
'/* prepage=mypage.prepage ' returns the page number of the previous page
'/*****************************************************************
Class Pageclass
Private Connection ' Connect the external Connection object of the database
Private Rs
Private List_fields
Private table_name
Private Query_where

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.