This example opens a table-type Recordset and selects an index for the Recordset. By setting an index, the Microsoft Jet database engine returns records in the order specified by the index. Without an index, table-type Recordset objects return records from the database table in no particular order.
CdbDBEngine dbeng;
CdbDatabase db;
CdbRecordset rstTitles;
// Open the database.
db = dbeng.OpenDatabase(_T("Biblio.mdb"));
rstTitles = db.OpenRecordset("Titles", dbOpenTable);
rstTitles.SetIndex(_T("MyIndex"));
...
...
...