Index Property

 

Description

 

Indicates the name of the index currently in effect for a Recordset object.

 

Sets or returns a String value, which is the name of the index.

 

PowerBASIC Syntax

 

PROPERTY GET Index () AS WSTRING

PROPERTY SET Index (BYVAL Index AS WSTRING)

 

Parameter (SET Index only)

 

Index

BSTR. The name of the index.

 

Return Value (GET Index only)

 

STRING. The name of the index, in unicode format.

 

Remarks

 

The index named by the Index property must have previously been declared on the base table underlying the Recordset object. That is, the index must have been declared programmatically either as an ADOX Index object, or when the base table was created.

 

A run-time error will occur if the index cannot be set. The Index property cannot be set:

 

Within a WillChangeRecordset or RecordsetChangeComplete event handler.
If the Recordset is still executing an operation (which can be determined by the State property).
If a filter has been set on the Recordset with the Filter property.

 

The Index property can always be set successfully if the Recordset is closed, but the Recordset will not open successfully, or the index will not be usable, if the underlying provider does not support indexes.

 

If the index can be set, the current row position may change. This will cause an update to the AbsolutePosition property, and the generation of WillChangeRecordset, RecordsetChangeComplete, WillMove, and MoveComplete events.

 

If the index can be set and the LockType property is adLockPessimistic or adLockOptimistic, then an implicit UpdateBatch operation is performed. This releases the current and affected groups. Any existing filter is released, and the current row position is changed to the first row of the reordered Recordset.

 

The Index property is used in conjunction with the Seek method. If the underlying provider does not support the Index property, and thus the Seek method, consider using the Find method instead. Determine whether the Recordset object supports indexes with the Supports(adIndex) method.

 

The built-in Index property is not related to the dynamic Optimize property, although they both deal with indexes.

 

Note

 

The SQL Server 6.5 or 7.0 doesn't support the Seek or Index methods of the Recordset. You can however, use the Index and Seek method with an Access 2000 database and the OLE DB 4.0 Provider for Jet.

 

Valid XHTML 1.0 Transitional