asp tutorials, asp.net tutorials, sample code, and Microsoft news from 15Seconds
Data Access  |   Troubleshooting  |   Security  |   Performance  |   ADSI  |   Upload  |   Email  |   Control Building  |   Component Building  |   Forms  |   XML  |   Web Services  |   ASP.NET  |   .NET Features  |   .NET 2.0  |   App Development  |   App Architecture  |   IIS  |   Wireless
 
Pioneering Active Server
 Power Search










Active News
15 Seconds Weekly Newsletter
• Complete Coverage
• Site Updates
• Upcoming Features

More Free Newsletters
Reference
News
Articles
Archive
Writers
Code Samples
Components
Tools
FAQ
Feedback
Books
Links
DL Archives
Community
Messageboard
List Servers
Mailing List
WebHosts
Consultants
Tech Jobs
15 Seconds
Home
Site Map
Press
Legal
Privacy Policy
internet.commerce














internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

HardwareCentral
Compare products, prices, and stores at Hardware Central!

Problem Sorting Recordset
By 15 Seconds Discussion List
Rating: 3.5 out of 5
Rate this article


  • email this article to a colleague
  • suggest an article

    Neil Kiser Writes:

    I have a recordset that is declared within the ASP page, then passed by reference to a VB COM object where it is actually created and populated.

    After the method of the COM object returns I would like to sort the data within the recordset, but it seems to have no effect and I receive no error messages. Does anyone have any suggestions? BTW, sorting at the fetching point is not ideal in our situation, hence the desire to re-order the recordset itself.

    Thanks for any advice.

    Here's the relevant lines of code:

    
    dim clsSearchMgr
    dim rsAccount
    
    set rsAccount = server.CreateObject("ADODB.RecordSet")
    set clsSearchMgr = Server.CreateObject("CBPWebAccount.Account")
    
    clsSearchMgr.Search(gcookUserID,rsFilter,rsAccount,rsError)
    
    rsAccount.Sort = "ACCTAcctAcctNum"
    
    

    Rob Chartier Responds With:

    You can either specify the sort order in the ORDER BY clause in the sql statement or use .SORT

    You could try to indicate which direction for your sort:

    
    rsAccount.Sort = "ACCTAcctAcctNum ASC"
    
    

    Neil Rebuts With:

    When we do this, we see no effect. We get no error and we get no satisfaction.

    We are using the .sort method. We can't alter our SQL (we could but it is more trouble than we want to go to right now - this SQL is used by several other places which would be affected, which means we would need to alter a lot of code to satisfy one small client request. The .sort method should allow us to tactically make this change.

    Jamie Hornstein Asks:

    You don't have OnErrorResumeNext turn on, do you?

    That's bitten me more than once :)

    I'm not sure just because you pass the recordset to the object, you can modify and the vbscript reference is still pointing at the same recordset. I guess everything's byref so it should be. I've never tried it.

    What if you turn your object into a function and have it return a recordset, then sort that?

    A Jubilant Neil Shouts:

    That was it! We were using the wrong field name (we were using the alias, but it seems that the .sort method requires the actual field name). Our On Error Resume Next was masking the error from us, all we knew was that the final result set was always the same.

    Thanks a bunch.

    This conversation string was taken from the 15Seconds ASP Listserv on 1/25/01. If you have an ASP-related question or would like to share some of your knowledge with others, you may join the list by clicking here.

  • Rate This Article
    Not HelpfulMost Helpful
    1 2 3 4 5
    Supporting Products/Tools
    CustomError 2.0 for IIS
    When errors occur on a Web site, they should be handled in a way that helps the user to get back on track. Unfortunately, setting up customized error pages in IIS usually requires something many Web developers lack -- access to and familiarity with the Web server's administrative interface. With CustomError for IIS, developers can add error pages, coded by hand or created in their favorite editor, by simply uploading them to a designated directory. No administrator intervention is required.
    [Top]
    Other Articles
    Sep 22, 2004 - Unit Test - Testing with NUnit Framework
    Kamran Qamar introduces unit testing with NUnit and offers some best practices, tips, and tricks.
    [Read This Article]  [Top]
    Aug 10, 2004 - Implementing and Promoting Daily Builds
    Automatic daily builds is a well known software engineering best practice. This article introduces a strategy for implementing and promoting daily builds and offers tips and tricks for preventing and fixing breaks.
    [Read This Article]  [Top]
    Jun 21, 2004 - Using Open Source .NET Tools for Sophisticated Builds
    Building an application can be more than pressing F5. With an increasing number of quality packages being released, developers for the .NET platform now have options to create a very sophisticated build process. Aaron Junod describes a sample build environment and shows how a number of tools can work together to make reliable, predictable, and value-added builds.
    [Read This Article]  [Top]
    Jun 18, 2003 - Online Database Functions Testing Tool
    This short article provides source code for a classic ASP online database functions testing application and shows how to configure and use the tool for either SQL Server or Oracle.
    [Read This Article]  [Top]
    Jan 2, 2003 - Web Application Error Handling in ASP.NET
    One of many improvements ASP.NET brings to the development table is in error handling. Adam Tuliper whips up a simple ASP.NET solution for handling those pesky and unexpected post-production errors.
    [Read This Article]  [Top]
    Sep 10, 2002 - Tracing in .NET and Implementing Your Own Trace Listeners
    Mansoor Ahmed Siddiqui explains debugging and tracing and shows how to create custom trace listeners to help ensure hassle-free development.
    [Read This Article]  [Top]
    Sep 5, 2001 - Firing Events in a Shared Hosting Environment
    Firing events on a Web server is an easy task. However most of the easy solutions require you to have your own dedicated IIS or SQL Server on the Internet to play with, a privilege not shared by many. In this article, Matthew Muller shows you how to get the same functionality in a shared hosting environment.
    [Read This Article]  [Top]
    May 25, 2001 - Avoiding a Type Mismatch Error When Using ByRef with ASP and COM
    Unlike programming inside a complete VB system, when using ByRef with ASP and COM, a complication arises because ASP's VBScript is not typed, but the component's VB is typed. This article will briefly explain how ByRef can be used with ASP and COM.
    [Read This Article]  [Top]
    Apr 18, 2001 - Error Reporting - IIS 5.0
    The script in Mark Newlands' article this week handles how errors are displayed and logged. It can capture all values in use at the time (e.g. form, querystring, session,and application level) and records them if you set a Boolean value to do so - displays custom HTML if required. Sends email, logs to database, and/or text file.
    [Read This Article]  [Top]
    Mar 12, 2001 - Transact-SQL Improves Database Error-Handling
    Transact-SQL provides developers with several database error-handling methods. Use these functions to efficiently handle database errors and add an extra level of data validation. This article discusses the @@ERROR, SP_ADDMESSAGE, and RAISERROR functions and provides examples on how to implement them.
    [Read This Article]  [Top]
    Mailing List
    Want to receive email when the next article is published? Just Click Here to sign up.

    Support the Active Server Industry



    JupiterOnlineMedia

    internet.comearthweb.comDevx.commediabistro.comGraphics.com

    Search:

    Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

    Jupitermedia Corporate Info


    Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

    Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers