Please note, this is a STATIC archive of website www.w3schools.com from 05 May 2020, cach3.com does not collect or store any user information, there is no "phishing" involved.
THE WORLD'S LARGEST WEB DEVELOPER SITE

ADO Sort Property


❮ Complete Recordset Object Reference

The Sort property sets or returns a string value that specifies the field names in the Recordset to sort on. Each field name must be separated by a comma. To choose the sort order, you can specify ASC (ascending order), or DESC (descending order) after the field name. Default is ASC.

Note: This property can only be used if the CursorLocation property is set to adUseClient.

Tip: If you set this property to an empty string (rs.Sort="") it will reset the records to their original order.


Syntax

objRecordset.Sort

Example

<%
rs.Sort="CompanyName,ContactName"
%>

or

<%
rs.Sort="CompanyName DESC,ContactName"
%>

or

<%
rs.Sort="CompanyName,ContactName,[Ship Address]"
%>

❮ Complete Recordset Object Reference