Developers Tutorials in ASP, PHP, ASP.NET, JSP, Python AND Ruby
 
Classic ASP ASP.NET PHP/mySQL JSP/Servlet Ajax Ruby Python Cold Fusion Perl Grails
  Home |   Topics |   Search |   Login / Register |   Rss Feeds


Topics
» Classic ASP
» ASP.NET
» PHP/mySQL
» JSP/Servlet
» Ajax
» Ruby
» Python
» Cold Fusion
» Perl
» Grails
Search news
Search for:

My Account
Email:

Password:


Register
Forgot password?

Listed in ASPin.com




site statistics



Recordset Paging Script



The code below pages the records returned from our database 'myLinks.mdb'. The table is called 'tblLinks' and has 3 fields, an 'ID' (autonumber field), a textfield called 'SiteName' and a memo field called 'URL'. This script can be easily modified to suit your requirements.


Title: Recordset Paging Script
Submit Date: Thursday, May 29, 2008
Last viewed at: Wednesday, March 10, 2010
Today Hit: 1
All Time Hit: 1233
Reviewed : 0 times
Voted : 0 times
Av. rating :
View tutorial
(0) posts Discuss (0 posts)      

More latest headlines in Classic ASP
A popular way to display data from a recordset, especially a large one, is in a paged fashion. For example, when you ask for all the data from a table in your database, you can see about 20 records neatly arranged in a grid fashion, with the ability to go to the next page, previous page, and so on. This 10-Minute Solution is the first of a series of three articles covering how to incorporate this common interface in your pages. The three articles are separated in terms of ease of understanding and use, from the simplest to the most complex. This first article shows how to display data, hitting the server and database once for each page requested.

In Part I of this series, we saw how to create a VBScript class to query our database using the very fast GetRows() method, and return a recordset as a local array. In Part II, we extended the class to allow ADDing and UPDATEing a row in the database. In this Part III, we will expand the class further to allow pagination of the returned recordset.

In un precedente articolo abbiamo visto la tecnica per impostare la paginazione su query molto lunghe in termini di mole di dati ed abbiamo analizzato il sistema per affidare all'oggetto Recordset l'intero compito gestire la paginazione, ma questo sistema, attraverso ASP, funziona solo con database di casa Microsoft come Access ed SQL Server, ma non col database oggetto di questo articolo: MySQL.

First, I created a field in the RECORDS table named ALPHA. Then using Access and Word, I copied the first letters of each horse's name into the ALPHA field from the NAMES field. By using ALT-click-drag I was able to copy only the first letters and paste them as a group back into the ALPHA field.

I created a new table called "LETTERS" with a field called "ABC" with a record for each letter of the alphabet. When this table is displayed, each letter is hyperlinked to the list of records that have the matching letter in their ALPHA field.


Ordering the recordset returned from your Access database is very easy - simply specify the columns you wish to order using an ORDER BY clause. When using the ORDER BY clause, ordering will happen by default in Ascending order (lowest to highest value). To order from highest to lowest value all you do is simply add the DESC keyword.

Some examples of ordering using the ORDER BY clause can be seen below.


The code below pages the records returned from our database 'myLinks.mdb'. The table is called 'tblLinks' and has 3 fields, an 'ID' (autonumber field), a textfield called 'SiteName' and a memo field called 'URL'. This script can be easily modified to suit your requirements.

As an ASP developer, I am constantly looking for new source code examples that will help make my job easier. Of course, using someone else's examples is far simpler than enduring the pain of the development process.

One of the examples I have seen on various sites involves paging through recordsets on a web page N records at a time. Most developers want to do this rather than present the entire recordset on a single page. First, this has the advantage of making faster page loads for site visitors, and secondly it makes for nicer pages.


This page demonstrates how to retrieve a recordset divided up into pages, and to only select data from a specified page. It  does not in any way store a recordset or connection in memory when the page is not accessed unlike many solutions you will read about. The ADO properties that make this magic possible are .AbsolutePage, .PageCount and .PageSize.

Recordset paging is the process of breaking up a recordset into multiple "pages" of information for display. You've probably noticed that most well designed sites implement this feature, allowing you to navigate through a recordset to view a certain number of records at a time. Breaking the recordset data into pages allows for easy browsing by the user of the application and it also adds a professional touch. When I first started encountering this feature on the web a few years back, I immediately began working on how to implement it for myself. The leisure of being able to casually browse and navigate through the results of a query was wonderfull and a heck of a lot better than having a few hundred records dumped on my browser all at once.

Filling a combo box with results a database query is something that ASP developers need to do often. This script will present an example of how to do just this. It's something every beginner should read and implement!







What's New
Ajax powered ASP user signup form
Cross domain access policy in Silverlight applications
LINQ the Bridge between the world of Objects & the world of Data
Dynamically creating DeepZoom composition
DoubleAnimation Basics with Silverlight Application
Display Paged Recordset Data
GetRows VBScript Class - Part III: Paging the results
ASP & MySQL Record Paging
Ways to get Alphabetical Paging for your ASP scripts
Sorting Database Records

Most Popular
How to embed UpdatePanel in a Repeater
Mark a GridView row, and move it with the up and down key
ASP & MySQL Record Paging
Cross-Page Posting Example
Implementing Cross-Domain Cookies
How to modify expire date of a cookie
Auto-upload using IE+ADO without user interaction
Ways to get Alphabetical Paging for your ASP scripts
Dynamically creating DeepZoom composition
Counting lines in text files

Copyright © 2009 Powered by GNews Publisher Positive. All rights reserved. Contact Us - Load Time: 0.22 second(s)