A collection is really a collection object that contains all the specific objects in the collection. Like all objects, a collection object has properties and methods.
For a collection named Objects, use the following syntax to refer to a collection object:
Parent.Objects
For example, to refer to the Databases collection of a SQLServer object:
oSQLServer.Databases
For a collection named Objects, you use a function named GetObjects to get a collection object from the parent object. Pass the address of a collection object variable (use the address of & operator) of the appropriate type (LPSQLOLEOBJECTS) to the GetObjects function. The GetObjects function will write the collection object pointer to your object variable. Use the following syntax:
pParent->GetObjects ( &pObjects );
For example, to get the Databases collection object from a SQLServer object:
LPSQLOLEDATABASES pDatabases; pSQLServer->GetDatabases (&pDatabases);