Sorting a Recordset

Results 1 to 3 of 3

Thread: Sorting a Recordset

  1. #1
    Aimee Guest

    Default Sorting a Recordset

    I&#039;m trying to do something really simple, and it&#039;s screwing up - don&#039;t no why.<BR><BR>I&#039;m trying to sort a recordset alphabetically prior to populating a list box with the records. Popoulating the control is fine, but the sort doesn&#039;t work. Hence, this is my code:<BR><BR>&#060;%<BR> Dim rsCompanies<BR> strCompanyView = "Select Company FROM Company"<BR> Set rsCompanies = Server.CreateObject("ADODB.Recordset")<BR> rsCompanies.Open strCompanyView, objConn<BR> <BR> If Not rsCompany.EOF Then<BR> rsCompanies.Sort = "Company"<BR> Response.Write _<BR> "&#060;td width=""375"" jhieght=""21""&#062;&#060;font <BR> size=""2"" face=""Arial""&#062;&#060;select <BR> name=""Company""&#062;" & _ "&#060;option selected&#062;Select Company" <BR> Do While Not rsCompanies.EOF<BR> Response.Write _<BR> "&#060;option&#062;" & rsCompanies("Company") <BR> rsCompanies.MoveNext<BR> Loop<BR> etc, etc, etc...<BR><BR>The following error occurs:<BR>ADODB.Recordset error &#039;800a0cb3&#039; <BR>The operation requested by the application is not supported by the provider. <BR><BR>Any ideas?

  2. #2
    Join Date
    Dec 1969

    Default RE: Sorting a Recordset

    sort it with SQL...I have built recordsets on the fly and have had to sort them like this:<BR><BR>RS.Sort = columnname & "ASC"

  3. #3
    Join Date
    Dec 1969

    Default RE: Sorting a Recordset

    get rid of this:<BR>rsCompanies.Sort = "Company" <BR><BR>and do this:<BR>strCompanyView = "Select Company FROM Company order by Company" <BR> <BR> <BR><BR> If Not rsCompany.EOF Then <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