CdbIndex::SetName, GetName Property

Sets or returns a user-defined name for a CdbIndex object.

Settings and Return Values

The setting or return value is a string that specifies a name. The name must start with a letter. The maximum number of characters is 64. It can include numbers and underscore characters but can't include punctuation or spaces.

Syntax

VOIDSetName(LPCTSTR pstr);

CStringGetName(VOID);

Set Parameters

Type Example Description
LPCTSTR pstr A string that contains a name.

Usage

CdbDBEngine      dben;
CdbIndex         idx;
CdbDatabase      dbs;
CdbTableDef      tdf;
CdbRecordset      rst;
   // Get your database.
dbs = dben.OpenDatabase(...);
   // Get your TableDef from the database.
tdf = dbs.TableDefs[_T("TableDefName")];
   // Get the first Index from the TableDef.
idx = tdf.Indexes[0L];
rst = dbs.OpenRecordset(...,dbOpenTable);
rst.SetIndex((LPCTSTR)idx.GetName());
rst.Seek(...);
...