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:
m_strName A name must be supplied.
m_pFieldInfos Must point to an array of CDaoIndexFieldInfo structures.
m_nFields Must specify the number of fields in the array of CDaoFieldInfo structures.
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 and in Visual C++ Programmer's Guide. For related information, see the topic "CreateIndex Method" in DAO Help.
CDaoTableDef Overview | Class Members | Hierarchy Chart
See Also CDaoTableDef::DeleteIndex, CDaoTableDef::CreateField, CDaoTableDef::DeleteField, CDaoIndexInfo