Navigation:  Samples >

Container sample

Previous pageReturn to chapter overviewNext page

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.

 

FUNCTION Start

LOCAL oDbEng        AS DaodBEngine

LOCAL oDb        AS DaoDatabase

LOCAL oCont        AS DaoContainer

LOCAL oDoc        AS DaoDocument

LOCAL i, j        AS LONG

LOCAL oErr AS USUAL

LOCAL cSysDb AS STRING

BEGIN SEQUENCE

set color TO w+/B

cls

 

oDbEng  := DaoDbEngine{}

cSysDb        := DaoRegistrySystemDb()

IF ! Empty(cSysDb) .and. File(cSysDb)

 oDbEng:SystemDb := cSysDb

ENDIF

 

 

oDb        := oDbEng:OpenDatabase("\VO2Jet\Northwind.mdb",NIL,NIL,NIL)

 

? " # of containers", oDb:Containers:Count

FOR i := 1 TO oDb:Containers:Count

 oCont := oDb:Containers:[item,i]

 ? ">>Container  :", oCont:name

 ? "  Owner      :", oCont:Owner

 ? "  UserName   :", oCont:UserName

 ? "  Inherited  :", oCont:Inherit_

 ? "  Permissions:", DaoEnum2Str(oCont:Permissions,DaoPermissionEnum(),TRUE)

 ? "  AllPermissions:", _AND(DWORD(oCont:AllPermissions),(DBSecFullAccess))=DBSecFullAccess

 ? "Document, Owner,DateCreated, LastUpdated"

 FOR j := 1 TO oCont:Documents:Count

         oDoc := oCont:Documents:[Item,j]

             ? PadR(oDoc:Name,25), PadR(oDoc:Owner,10), oDoc:DateCreated, oDoc:LastUpdated

 NEXT

 wait

NEXT

RECOVER USING oErr

 Eval(ErrorBlock(),oErr)

END

Wait