CdbRecordset::SetSort, GetSort Property

Sets or returns the sort order for records in a Recordset object.

GetSort returns the sort order in a CString.

Syntax

VOIDSetSort(LPCTSTR pstr);

CStringGetSort(VOID);

Set Parameters

Type Example Description
LPCTSTR pstr A pointer to a string that contains the ORDER BY clause of an SQL statement without the reserved words ORDER BY.

Remarks

You can use the Sort property with dynaset- and snapshot-type Recordset objects.

When you set this property for an object, sorting occurs when a subsequent Recordset object is created from that object. The Sort property setting overrides any sort order specified for a QueryDef object.

The Sort property doesn't apply to table-type Recordset objects. To sort a table-type Recordset object, use the Index property.

In many cases, it's faster to open a new Recordset object using an SQL statement that includes the sorting criteria.