Help Sorting Recordset

Results 1 to 2 of 2

Thread: Help Sorting Recordset

  1. #1
    Join Date
    Dec 1969

    Default Help Sorting Recordset

    I&#039;m having problems trying to sort a recordset on an ASP <BR>page. This particular recordset is created locally and <BR>does not connect to a database.<BR><BR>Here&#039;s how I&#039;m creating my recordset...<BR><BR>Set rss = Server.CreateObject("ADODB.Recordset")<BR>With rss<BR> .Fields.Append "agency_name", adVariant &#039;adBSTR<BR> .Fields.Append "subjects_viewed", adInteger<BR> .Fields.Append "subjects_created", adInteger<BR> .CursorLocation = adUseClient<BR> .Open<BR>End With<BR><BR>I then load the recordset and attempt to sort it using the <BR>sort property... <BR><BR>rss.Sort = "agency_name ASC"<BR><BR>Which gives me the error: "Order cannot be opened"<BR><BR>I can sort fine on any of the integer fields.<BR>I have tried making the "agency_name" field an adBSTR type <BR>which does not change the symptoms.<BR><BR>Any help would be appreciated<BR>

  2. #2
    Join Date
    Dec 1969

    Default ADO can't handle variant...

    Read the docs!<BR><BR><BR><BR>*** QUOTE ***<BR>Type <BR>A DataTypeEnum value, whose default value is adEmpty, that specifies the data type of the new field. The following data types are not supported by ADO, and should not be used when appending new fields to a Recordset: adIDispatch, adIUnknown, adVariant.<BR>*** END QUOTE ***<BR><BR>You should be using adVarChar for strings. (Though I suppose adBSTR might work, too.) But then don&#039;t forget to give the field a size, or you will get the default of 0 characters!<BR><BR> .Fields.Append "agency_name", adVarChar, 255<BR><BR>Or whatever.<BR><BR><BR> <BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts