From RAD Studio API Documentation
Jump to: navigation, search


property IndexName: WideString read GetIndexName write SetIndexName;


__property System::WideString IndexName = {read=GetIndexName, write=SetIndexName};


Type Visibility Source Unit Parent
property public
Data.Win.ADODB TCustomADODataSet


Specifies the currently active index.

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.

See Also