Owner Property Example (VC++)

This example changes the Owner property setting of a Document object after determining whether the current user has the appropriate permissions to do so.

CdbDBEngine   DBEng;
CdbDatabase   dbsNorthwind;
CdbDocument   docTest;

dbsNorthwind =  DBEng.OpenDatabase(_T("Northwind.mdb"));
docTest = dbsNorthwind.Containers[0L].Documents[0L];
if ((docTest.GetPermissions() & dbSecWriteOwner) != 0)       docTest.SetOwner(_T("SomebodyElse"));