RecordCount Property Example (VC++)

This example creates a Recordset object based on the Employees table and then determines the number of records in the Recordset.

CdbDBEngine      dbeng;
CdbDatabase      dbsNorthwind;
CdbRecordset   rstEmployees;
long            lTotal;

dbsNorthwind = dbeng.OpenDatabase(_T("Northwind.mdb"));
rstEmployees = dbsNorthwind.OpenRecordset(_T("Employees"));
rstEmployees.MoveLast();
lTotal = rstEmployees.GetRecordCount();

if (lTotal == -1)
   printf(_T("Count not available\n"));

dbsNorthwind.Close();