Paging and caching large record sets Support

How to optimise this process both for the person doing the viewing and for the server processing the page.

Today we look at viewing large record sets, and how to optimise this process both for the person doing the viewing and for the server processing the page. To handle the former, we'll use a technique known as paging, and for the latter, caching. This caching is not the client side browser caching we've all come to know and hate; this caching is done entirely on the server.

 

The code supplied is half the length of the Dreamweaver-generated code, and is hugely beneficial if you have a site where users look through large lists of data without amending it.

Advertisement DMXzone Paginator ASP

Add the coolest page navigation to your site and make browsing through large lists of items or tables easy and quick. Choose from 22 different styles, used by many sites such as Digg, Yahoo, Flickr and much more, to fit perfectly with your design and display the total number of items.

All paging styles are fully CSS based, so you can always fine tune the colors and borders to your site design.

 

Paging and caching large record sets

Welcome to our next foray into database driven ASP development. Today we're going to be looking at viewing large record sets, and how to optimise this process both for the person doing the viewing and for the server processing the page. To handle the former, we'll use a technique known as paging, and for the latter, caching. This caching is not the client side browser caching we've all come to know and hate; this caching is done entirely on the server. Let's jump right in!

Creating the page with the recordset

First off, we're going to create a simple page using Dreamweaver, which will use a standard Dreamweaver connection to create a standard Dreamweaver recordset. We will then use a Server Behaviour to display the contents of this recordset.

1. Create the connection

As in the previous tutorial, we're going to use a DSN (Data Source Name):

Create the DSN

-          Copy the database file to your web server folder (It's in the link "Code download" below the download buttons).

-          Click Start > Programs > Administrative Tools > Data sources ( ODBC )

-          Select the System DSN tab, and click Add…

-          Select the Microsoft Access Driver (*.mdb)

-          Enter a name for your new data source. I've called mine PagingSample.

-          Click the Select… button and browse to your copy of PagingSample.mdb.

-          You should see the path to PagingSample.mdb above the select button. Click OK.

-          Click OK to close the Data sources panel.

Before you can define a Connection with Dreamweaver, you will need to create a new Site first. If you have not done so, be sure to do so now. (Molly Holzschlag has a tutorial on setting up your site, if you're unsure how).

Create the Connection in Dreamweaver

-          If your Application panel group is not visible, use Window > Databases to make it appear.

-          Click the + icon in the Databases panel, and select Data Source Name (DSN) from the list.

-          Enter a name for your new connection, I used PagingSample.

-          Select your DSN from the drop-down list.

-          Click the Test button. You should see a message: 'Connection was made successfully.'

-          Click OK on the notification, and click OK again to save the new Connection.

-          You should now see a Connection in the Databases panel.

And you're done! You should now be able to browse through the database's tables, views, and stored procedures. This database contains a single table, Orders. For the sake of clarity, I haven't normalised the data for this table.

Robert Stuttaford

Robert StuttafordI live in Cape Town, South Africa. I've been pushing 1's and 0's ever since my first computer at the age of 11. Ever since then I've always known I'll be a geek. I now work for Wireframe Studio in sunny Cape Town, and have been for the last 3 years. I'm the database / ASP / dynamic Flash guy here. I'm also one of the XHTML / CSS guys. I have alot of fun in my work because I develop solutions in a variety of ways. I always have something to do, and one project is always different to the next. I actually do have a girlfriend amongst all that!

See All Postings From Robert Stuttaford >>