If you've ever used an electronic bulletin board program on many websites, you should know that the bulletin board program, in order to improve the reading speed of the page,
Generally not all of the posts are listed in a page, but it is divided into multiple pages, each page
Displays a certain number of posts, such as 20. Do you want to know how to implement a paging display? Please see
This paper!
So how exactly can you do to the database query results page display it? In fact, there are many ways,
But there are two main types:
First, all records that meet the query criteria in the database are read into the recordset at once,
stored in memory, and then through the ADO Recordset object provided by several specialized support paging office
Attributes: PageSize (page size), PageCount (number of pages), and
AbsolutePage (Absolute page) to manage paging processing.
Second, according to the customer's instructions, each time from the records to meet the requirements of the record will be the number of notes
The recorded number is read and displayed.
The main difference between the two is that the former is a one-time read all the records into memory and then according to the instructions
In order to make a judgment analysis to achieve the results of pagination, the latter is based on the instructions to make judgments and
The specified number of records that match the query criteria are read into memory, which directly achieves the function of paging display.
We can clearly feel that when the number of records in the database reaches tens of thousands or more, the first
The execution efficiency of the method will be significantly lower than the second method, because every customer queries the page
Store all eligible records in server memory, and then handle paging, if
With more than 100 customer inquiries online, the efficiency of ASP applications will be greatly affected by
Effect. However, when the number of database records on the server and the number of people online are not many,
The efficiency of the two is the same, at this time the first method is generally used, because the first
Method of ASP program writing is much simpler and more straightforward than the second method.
Here the author of our common ASP BBS program as an example, to give you an analysis of how to
In the BBS program to achieve the paging display function, due to our general use of the BBS program database
Both the number of records and the number of people who have access are not too many, so the following program instance is used as described previously
The first way to display pagination.
When you make ADO access to the database, the paging display is actually a record of the recordset
to operate. So we first have to understand the properties and methods of the Reordset object:
BOF attribute: Current indicator refers to the first pen in the RecordSet.
EOF attribute: The current indicator refers to the last stroke of the RecordSet.
Move method: Moves the metric to a record in the recordset.
AbsolutePage Property: Sets the location of the current record in which page
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