PercentPosition Property Example (VC++)

This example displays the current position of a record in a Recordset in a message box.

CdbDBEngine   DBEng;
CdbDatabase   dbsNorthwind;
CdbRecordset   rstEmployees;
Cstring   stPrctPos;

dbsNorthwind =  DBEng.OpenDatabase(_T("Northwind.mdb"));
// Open table.
rstEmployees = dbsNorthwind.OpenRecordset(_T("Employees"));
// Set current index.
rstEmployees.SetIndex(_T("Last Name"));
//...
//...   ' Move among the records.
//...
//' Display current position.
stPrctPos.Format(_T("%f"), rstEmployees.GetPercentPosition());
printf(_T("Current position is %s%%."), stPrctPos);