PRB: ADO Recordset Sort Property Errors

ID: Q216875


The information in this article applies to:
  • ActiveX Data Objects (ADO), versions 1.5, 2.0, 2.01, 2.1 SP2


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 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.

Additional query words:

Keywords : kbdocerr kbADO kbADO200 kbDatabase kbGrpVBDB kbGrpMDAC kbDSupport kbADO210sp2fix
Version : WINDOWS:1.5,2.0,2.01,2.1 SP2
Platform : WINDOWS
Issue type : kbprb


Last Reviewed: November 17, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.