Index Property

See Also   Applies To

Sets or returns a value that indicates the name of the current CdbIndex object in a table-type CdbRecordset object (Microsoft Jet workspaces only).

Syntax

VOIDSetIndex(LPCTSTR pstr );

CStringGetIndex(VOID);

Parameters

Type Argument Description
LPCTSTR pstr A string containing the name of a CdbIndex object.

Remarks

Records in base tables aren't stored in any particular order. Setting the Index property changes the order of records returned from the database; it doesn't affect the order in which the records are stored.

The specified CdbIndex object must already be defined. If you set the Index property to a CdbIndex object that doesn't exist or if the Index property isn't set when you use the Seek method, a trappable error occurs.

Examine the Indexes collection of a CdbTableDef object to determine what CdbIndex objects are available to table-type CdbRecordset objects created from that CdbTableDef object.

You can create a new index for the table by creating a new CdbIndex object, setting its properties, appending it to the Indexes collection of the underlying CdbTableDef object, and then reopening the CdbRecordset object.

Records returned from a table-type CdbRecordset object can be ordered only by the indexes defined for the underlying CdbTableDef object. To sort records in some other order, you can open a dynaset-, snapshot-, or forward-only–type CdbRecordset object by using an SQL statement with an ORDER BY clause.

Notes