Microsoft KB Archive/216875

= FIX: ADO Recordset Sort Property Errors =

Article ID: 216875

Article Last Modified on 8/23/2001

-

APPLIES TO


 * Microsoft ActiveX Data Objects 1.5
 * Microsoft ActiveX Data Objects 2.0
 * Microsoft ActiveX Data Objects 2.01

-



This article was previously published under Q216875



SYMPTOMS
The ADO documentation for the Sort property of the Recordset states the following:

Sets or returns a String of comma-separated field names to sort on where each name is a Field in the Recordset and is optionally followed by a blank and the keyword ASCENDING or DESCENDING.

However, when you set the Sort property to au_id DESCENDING (where au_id is a field in your database), the following error occurs on the Recordset::Open: -2146825287

The application is using arguments that are of the wrong type, are out of acceptable range, or are in conflict with one another.

The current ADO 2.1 and later documentation corrects the syntax. The keywords are DESC instead of DESCENDING and ASC instead of ASCENDING. If you set the Sort property to au_id DESC or au_id ASC, it will work with the versions of ADO mentioned at the beginning of this article.



STATUS
The documentation after ADO 2.1 documentation corrects the syntax. The keywords are DESC instead of DESCENDING and ASC instead of ASCENDING. If you set the Sort property to au_id DESC or au_id ASC, it will work with the versions of ADO mentioned at the beginning of this article.



MORE INFORMATION
The following errors might also occur after you set the Recordset Sort property. Some possible causes are included for troubleshooting.

Error Message 1
-2146825023

ADO could not find the object in the collection corresponding to the name or ordinal reference requested by the application.

CAUSE: This might happen if you try to sort on a field that is not included in the Select that generated the Recordset. For example, if the Recordset SQL is "Select au_id, au_lname from authors", and you set the Sort property to au_fname, this error occurs on the Recordset::Open. To work around this problem, make sure that the field you are sorting on is included in the Recordset.

Error Message 2
-2146825037

The operation requested by the application is not supported by the provider.

CAUSE: This error occurs if you specify a server-side cursor, set the Sort property, and try to Open the Recordset. You can only use Sort on client-side cursors.

Keywords: kbbug kbfix kbdatabase kbado210sp2fix kbdocerr kbmdacnosweep KB216875

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.