CdbContainer Object

See Also    Example        Properties

A CdbContainer object groups similar types of CdbDocument objects together.





Remarks

Each CdbDatabase object has a Containers collection consisting of built-in CdbContainer objects. Applications can define their own document types and corresponding containers (Microsoft Jet databases only); however, these objects may not always be supported through DAO.

Some of these CdbContainer objects are defined by the Microsoft Jet database engine while others may be defined by other applications. The following table lists the name of each CdbContainer object defined by the Microsoft Jet database engine and the type of information it contains.

CdbContainer Contains information about
Databases Saved databases
Tables Saved tables and queries
Relations Saved relationships

Note Don't confuse the CdbContainer objects listed in the preceding table with the collections of the same name. The Databases CdbContainer object refers to all saved database objects, but the Databases collection refers only to database objects that are open in a particular workspace.

Each CdbContainer object has a Documents collection containing CdbDocument objects that describe instances of built-in objects of the type specified by the CdbContainer. You typically use a CdbContainer object as an intermediate link to the information in the CdbDocument object. You can also use the Containers collection to set security for all CdbDocument objects of a given type.

With an existing CdbContainer object, you can:

Because CdbContainer objects are built-in, you can't create new CdbContainer objects or delete existing ones.

To refer to a CdbContainer object in a collection by its ordinal number or by its Name property setting, use any of the following syntax forms:

Containers[0]

Containers["name"]

CdbContainer Constructor Syntax

Use any one of the following three constructors. The qualifier 'CONSTRUCTOR' in the syntax models is provided to help readability. It has no syntactic value.

CONSTRUCTORCdbContainer(VOID);

This constructor creates an instance of the class. There are no parameters.

CONSTRUCTORCdbContainer(const CdbContainer &);

Type Description
const CdbContainer & Reference to an object.

This constructor creates a copy of the object referenced in the parameter.

CONSTRUCTORCdbContainer(DAOContainer *pctn,

BOOL bAddRef = FALSE);

Type Argument Description
DAOContainer * pctn A DAO Automation interface pointer corresponding to this DAO class.
BOOL bAddRef
=FALSE
Optional. A Boolean. If TRUE, the DAO Automation interface AddRef function is called.

DAO functionality is presented through pointers to DAO Automation interfaces. This constructor makes a DAO interface available in the form of a DAO class object that provides additional functionality.

This constructor is not required for typical use. It is provided to enable you to easily create a DAO class object when you have access to the corresponding DAO interface.

When the destructor for the DAO object is invoked, the underlying Automation interface's Release member is called. If Release decrements the interface's reference count to zero, the pointer to the Automation interface can be deleted. If you don't want this to happen (for example, because you want to discard the DAO object, but continue using the Automation interface), specify TRUE for the second parameter. The underlying Automation interface's AddRef member is called, which counterbalances the eventual call to Release.