• subscribe
April 26, 2001 12:00 AM

Filtering and Sorting in ASP

SQL Server Pro
InstantDoc ID #20357
Downloads
20357.zip

An easy interface that users and developers can love

Performance and ease of use are top application development goals. Sometimes these two goals are mutually exclusive, but they don't need to be. In this issue, I show you how to solve an ease-of-use and performance problem with one simple Active Server Pages (ASP) page.

This article's sample application retrieves and displays Contact table data in an intranet application for our training company's sales and management teams. The application's ease-of-use goals are threefold: to display a contact list from the Contact table in SQL Server, to help users find contacts quickly, and to let users manipulate the contact data by sorting it different ways. The application also needs to perform well by displaying the results quickly. ASP can meet these goals easily because it lets you create flexible pages in script. I use VBScript because of its ease of use and its prevalence in Web applications. You can easily benefit users by using script to build flexible features such as sorting into your applications.

Listing 1 shows the T-SQL code that creates the Contact table. Web Listing 1 shows database.asp, which contains the ADO and ASP code you need to access the database that contains the Contact table. (For download instructions, see the More on the Web box, page 62.) I don't show database.asp here because it's very similar to adohelper.asp, which I wrote about in "Standardizing Data Access with ADO and ASP Scripts," http://www.sqlmag.com, InstantDoc ID 15986.

Displaying the Contact Data
The first problem our company needed to solve was how to display the contact data. We didn't want to list all the contacts when a user visited the intranet page because the Contact table is large and growing rapidly. Displaying all of a page's data drains SQL Server and pushes a large volume of data across the network, slowing down the page and delaying users as they try to sort and find the information they need.

So, we filtered the data by limiting the initial data display to contacts whose last names started with A. The filtering process gives users three options: selecting a displayed last name beginning with A, selecting other last names by their first letter, or selecting All Contacts. Figure 1, page 62, shows the page's interface, which is clean and works like the interface for the Contacts table in Microsoft Outlook. Users can sort the display by clicking any column header in the table, and in Edit mode, they can open a contact by clicking it.



ARTICLE TOOLS

Comments
  • Patricia Ortega-Ruiz
    11 years ago
    May 31, 2001

    I am unable to download the SQLContactList.asp file from your Instant document 20357. I am only getting the WEB LISTING 2 txt file that doesn't have the code that I am interested in. Could you please let me know where I can get it?.

    Thanks!

You must log on before posting a comment.

Are you a new visitor? Register Here
  • SP1?
    I know there is a SP1 for SQL 2008 R2 available....and there is a "feature pack" as well... ...
  • SQL database mirroring
    I have SQL Server 2008 R2 Enterprise 64bit on Windows 2008 R2 Enterprise 64bit.  Each SQL Server has...
  • Dell Compellent Disk Drive
    Does anybody has experience with Dell Compellent Disk Drive? Basically, this system manages all disk...
  • Sql server performance tuning
    I need to find a tool that help me to optimize sql server,queries,improve the performance and solve ...