DistinctCount Property Example (VC++)

This example checks the DistinctCount property of an Index of a TableDef object opened on a table in the database.

CdbDBEngine      dbeng;
CdbDatabase      dbsNorthwind;
CdbTableDef      tdfCustomers;
CdbIndex      idxCurrent;

dbsNorthwind = dbeng.OpenDatabase(_T("Northwind.mdb"));
tdfCustomers = dbsNorthwind.TableDefs[_T("Customers")];
idxCurrent = tdfCustomers.Indexes[0L];

printf(_T("  DistinctCount: %s\n"), idxCurrent.GetDistinctCount());