To add a new SQL-DMO object to a collection, you use the following steps:
Adding a SQL-DMO object to a collection creates that SQL Server object.
After creating a new SQL-DMO object with the New keyword of the Dim statement or the CreateObject function, you set the properties of the new object as appropriate for the new object. Then you add the new object to the appropriate collection using the following syntax:
Objects.Add NewObject
After creating a new SQL-DMO object with the CoCreateInstance function, you set the properties of the new object as appropriate for the new object. Then you add the new object to the appropriate collection using the following syntax:
pObjects->Add ( pNewObject );
You can also use the AddObject "shortcut" function of the parent object to add the new object using the following syntax:
pParent->AddObject ( pNewObject );