Count Property Example (VC++)

This example lists the names and total number of TableDef and QueryDef objects in the current database.

CdbDBEngine      dbeng;
CdbDatabase      dbsLocal;
int               intCount, intMax;

dbsLocal = dbeng.OpenDatabase(_T("Northwind.mdb"));
   
// Print TableDef names and count.
intMax = dbsLocal.TableDefs.GetCount(); 
for (intCount=0; intCount < intMax; intCount++)
   printf(_T("  %s\n"), 
      dbsLocal.TableDefs[intCount].GetName());
printf(_T("TableDef Count = %d\n\n"), intMax);
   
// Print QueryDef names and count.
intMax = dbsLocal.QueryDefs.GetCount(); 
for (intCount=0; intCount < intMax; intCount++)
   printf(_T("  %s\n"), 
      dbsLocal.QueryDefs[intCount].GetName());
printf(_T("QueryDef Count = %d\n\n"), intMax);

dbsLocal.Close();