Container Object, Containers Collection, and Document Object, Documents Collection Example (VC++)

This example enumerates the properties of all the Container and Document objects in the current database. See the properties listed in the Container and Document summary topics for additional examples.

CdbDBEngine      dbeng;
CdbDatabase      dbsCurrent;
CdbContainer   conTest;
CdbDocument      docTest;
int            i, j;

dbsCurrent = dbeng.OpenDatabase(_T("Northwind.mdb"));
for (i = 0; i < dbsCurrent.Containers.GetCount(); i++)
{
 conTest = dbsCurrent.Containers[i];
   printf(_T(">> Container: %s\n"), conTest.GetName());
   printf(_T("  Owner: %s\n"), conTest.GetOwner());
   printf(_T("  UserName: %s\n"), conTest.GetUserName());
   printf(_T("  Permissions: %s\n\n"), conTest.GetPermissions());
 for (j = 0; j < conTest.Documents.GetCount(); j++)
 {
      docTest = conTest.Documents[j];
      printf(_T(" > Document: %s\n"), docTest.GetName());
      printf(_T("  Owner: %s\n"), docTest.GetOwner());
      printf(_T("  Container: %s\n"), docTest.GetContainer());
      printf(_T("  UserName: %s\n)"), docTest.GetUserName());
      printf(_T("  Permissions: %08xd\n"),docTest.GetPermissions());
      printf(_T("  DateCreated: %s\n"), docTest.GetDateCreated());
      printf(_T("  LastUpdated: %s\n\n"), docTest.GetLastUpdated());
 }
}