Re: Sorting recordsets



Griff wrote:
I create an empty recordset:
....
I populate it with rows.
...
I then attempt to sort it using:
    oRSResults.sort = "len(firstName) desc"

And this errors telling me that the item can not be found in the collection. However, I can sort it using "firstName desc" and this works fine.

You can't use expressions/functions to specify the sort order:

cf

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/his_2004main/htm/_sna_sort_property_oledb.asp

Recordset.Sort BSTR Criteria

This parameter specifies the criteria used for sorting the Recordset object. This Sort property contains a comma-delimited list of column names and a direction specifier ...

But you could add a field for "len(firstName)" to your recordset and use this
to sort.
.



Relevant Pages

  • Re: Yay!
    ... Isn't it about time you and Griff went to bed? ... Pardon me? ... You sound like a married couple. ... which sort of married couple? ...
    (uk.education.staffroom)
  • Re: A Fast sorting algorithm for almost sorted data
    ... far my compressor has potential but is nowhere near ready. ... It does however make heavy use of sorting. ... which I am currently calling Run sort. ... entire selected run can be added to the sorted output array. ...
    (comp.compression)
  • Re: Solution for sorting an array alpha-numerically
    ... strings up into groups and sorting the groups seperately, ... > so that numeric and alphabetic data sort as seperate groups. ... To the same project as the web page, add the class AlphaNumCompare() ...
    (microsoft.public.dotnet.general)
  • Re: how fast can I sort on mainframe (using DFSORT)?
    ... Since I joined the team as the performance lead a couple years ago, ... Frank now defers these types of questions to me. ... I have been out of the sorting business for a while, ... Writing to sort work files should not be the problem, ...
    (bit.listserv.ibm-main)
  • Re: When random isnt random
    ... >> (and, if there is not one already, a Sorting Unit). ... TList has a Sort method. ... Try it with a TList and in the compare function ... There seems to be, sometimes, a requirement for a Shuffle that leaves ...
    (borland.public.delphi.language.objectpascal)