Listing Records and ADO Recordset Paging in ASP
Using databases gives us lots of advantages. Listing and paging our records dynamically is one of them. In our applications, we may need to show so many records to user and in order to make it clear we have to list them well-arranged. However, listing too many database records in one time can be a handicap for us, because if the number of records reaches the huge values, then loading pages takes long time. So, we should separate records to pages. It means that in respect of number of database records, pages will be created automatically and a specified number of records will be shown on each page.
We have to know some paging and listing statements to do this issue. There are some paging and listing statements which will be used in this article.
Paging Statements
- PageSize is used to define limit number of records which will be shown in each page.
- AbsolutePage is used to determine the page selected.
- PageCount is used to get number of pages created automatically.
Listing Statements
- Move(X) is used to get Xth record from current record.
- MoveNext is used to get the next record.
- MovePrevious is used to get the previous record.
- MoveLast is used to get the last record.
- MoveFirst is used to get the first record.
There is also RecordCount statement for getting number total records but this is optional. You don’t have to use it.
To make it clear, let’s make an example. We are going to create a database connection to get records. We have talked about connecting databases in ASP before. So, we are skipping this issue now.
Example 1.0: We are going to make a list of customers on customers.asp
Output of Example 1.0: customers.asp?pg=1
Output of Example 1.0: customers.asp?pg=3
We stated the basics of paging and listing records. From now on, you can make different algorithms to make your lists. There are some little additions for making this example more useful.
1.1 ) Detecting the page selected and emphasizing it.
If we want to write the page selected different from the other page links, we can use these codes instead of the codes that start at line 32 in example 1.0.
Example 1.1: An Addition to Example 1.0
Output of Example 1.1: customers.asp?pg=1
Output of Example 1.1: customers.asp?pg=3
As you see, we wrote M for the page selected. Henceforth, imagination is up to you.

Recently Typed