CDaoTableDef::CreateIndex

void CreateIndex( CDaoIndexInfo& indexinfo );
throw( CDaoException, CMemoryException );

Parameters

indexinfo

A reference to a CDaoIndexInfo structure.

Remarks

Call this function to add an index to a table. Indexes specify the order of records accessed from database tables and whether or not duplicate records are accepted. Indexes also provide efficient access to data.

You do not have to create indexes for tables, but in large, unindexed tables, accessing a specific record or creating a recordset can take a long time. On the other hand, creating too many indexes slows down update, append, and delete operations as all indexes are automatically updated. Consider these factors as you decide which indexes to create.

The following members of the CDaoIndexInfo structure must be set:

The remaining members will be ignored if set to FALSE. In addition, the m_lDistinctCount member is ignored during creation of the index.

For more information on tabledefs, see the articles DAO Tabledef and DAO Tabledef: Using Tabledefs in Visual C++ Programmer's Guide. For related information, see the topic "CreateIndex Method" in DAO Help.

CDaoTableDef OverviewClass MembersHierarchy Chart

See Also   CDaoTableDef::DeleteIndex, CDaoTableDef::CreateField, CDaoTableDef::DeleteField, CDaoIndexInfo