p2p.wrox.com Forums

Need to download code?

View our list of code downloads.

  Return to Index  

proasp_codeclinic thread: Recordset Manipulation

Message #1 by "Patrick Mair" <pmair@e...> on Fri, 8 Mar 2002 11:37:22 -0700
When you do:

Set objRS = objConn.Execute or objCommand.Execute

then you are opening a recordset with the default adOpenForwardOnly cursor.
This cursor does not support methods such as .Sort.

Instead, you are better off sorting the records before they are retrieved
into the recordset, by using the ORDER BY clause in your SQL statement.


From: "Patrick Mair" <pmair@e...>
Subject: [proasp_codeclinic] RE: Recordset Manipulation

: Thanks Jason,
: The data I'm working with won't be changing very quickly, and based on the
: number of people accessing the site I think option 1 should work but I'd
: like to know how to get option 2 going just to be able to use it as an
: option in the future.  I noticed someone else has given me a link to some
: DHTML for sorting and manipulating tables (thanks Mark).
: When I try to sort via ADO I get an ADO recordset error saying that the
: recordset doesn't support this property.  Currently I generate my
: using the following code:
: 'opens the database
: Set dbconn = Server.Createobject("ADODB.Connection")
: dbconn.Open strConnect
: 'sql
: gpsql = "sql here"
: 'execute query
: Set rsprojects = dbconn.Execute(gpSQL)
: I've tried a few variations on opening the recordset up in different ways
: but so far none have allowed me to execute:
: rsprojects.Sort = "proj_num DESC"
: Which I'm hoping to use to sort by project number (proj_num), descending
: (DESC).
: Any thoughts on how I should open up my recordset to allow for ADO
: Patrick


  Return to Index