RAD Studio VCL Reference
TCustomADODataSet.IndexName Property

Specifies the currently active index.

property IndexName: WideString;
__property BSTR IndexName;

Use IndexName to activate an index and cause it to actively order the dataset’s rows. At runtime, set IndexName to a string containing the name of the index. At design-time, select the desired index from the drop-down list in the Object Inspector.

ADOTable1.IndexName := 'LastName';


ADOTable1->IndexName = "LastName";

Set IndexName to an empty string to have no index actively ordering the dataset. The rows then appear in natural order. In some database systems, the primary index of a table does not have a name. In these cases, setting IndexName to an empty string activates the primary index. 

An index must be active for certain index dependent operations to be used, such as the Seek method.

Note: Many providers do not support changing indexes while the dataset is active, raising an exception when an attempt is made to do this. Ensure that the dataset is closed before changing the index through the IndexName property and reopen the dataset after specifying a new index.


Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!