Description

Add a [new] McDBNode (or reference) to this McDBNodes collection.

Return Type

A McDBNode object.  

Syntax

object.Add (TypeOrObject, Name, [AddMethod], [Settings])

The Add Method syntax has these parts:

PartDescription
objectAn expression evaluating to an object of type McDBNodes.
TypeOrObjectRequired. A Variant value.

The McDBType or McDBNode to add to this collection. Either an McDBNode instance, an McDBType (for the new child McDBNode) instance, or the string McDBType.Name of the McDBType for the new child McDBNode. The McDBType.Database must be the same as the McDBNode.Database of the McDBNode whose McDBNode.Children are represented by this collection.

NameRequired. A String value.

The name to give the new node McDBNode created by this method. Either the name the symbolic link will have in the context of the McDBNode.Children represented by this McDBNodes or the native name of a new McDBNode. This parameter must follow the rules for validity for McDBNode::Name. When this collection does not represent the McDBNode.Children of an McDBNode (i.e. the contents of this collection have more than one McDBNode.Parent), this parameter is ignored and the native McDBNode::Name is always used.

AddMethodOptional. A mcDBAddMethod enumeration, as described in settings.
A mcDBAddMethod value, indicating how the TypeOrObject is to
    be added to this collection:
mcdbNewNode

Create a new McDBNode and add it to this collection. TypeOrObject must be an McDBType or the string McDBType.Name for the new node.

mcdbAlias

TypeOrObject must be an McDBNode, which will be symbolically linked (aliased) by Name in the McDBNode.Children collection this McDBNodes represents.

mcdbNewNodeShareData

TypeOrObject must be an McDBNode, whose McDBNode.Data will be shared by a newly created child node in the McDBNode.Children this McDBNodes represents. The new McDBNode will have the name specified by Name and the same McDBType as the McDBNode in TypeOrObject. This operation shares the McDBNode.Data property between these instances, but NOT McDBNode.Attributes. It is the same as adding a new child node and then calling its McDBNode.ShareDataOf with the McDBNode in TypeOrObject.

mcdbNewNodeShareAttributes

TypeOrObject must be an McDBNode, whose McDBNode.Attributes are shared with a newly created child node in the McDBNode.Children this McDBNodes represents. The new child McDBNode will have the name specified by Name and the same McDBType as the McDBNode in TypeOrObject. This operation is the same as adding a new child node and then calling its McDBNode.ShareAttributesOf with the McDBNode in TypeOrObject.

mcdbNewNodeCopyData

TypeOrObject must be an McDBNode, whose McDBNode.Data is copied to a newly created child node in the McDBNode.Children this McDBNodes represents. The new child McDBNode will have the name specified by Name and the same McDBType as the McDBNode in TypeOrObject. Unlike mcdbNewNodeShareData, the McDBNode.Data property of TypeOrObject is copied to the new child McDBNode, and the McDBNode.Data property of each McDBNode remains independent of the other.

mcdbNewNodeCopyAttributes

TypeOrObject must be an McDBNode, whose McDBNode.Attributes are copied to a newly created child node in the McDBNode.Children this McDBNodes represents. The new child McDBNode will have the name specified by Name and the same McDBType as the McDBNode in TypeOrObject. Unlike mcdbNewNodeShareAttributes, the McDBNode.Attributes of TypeOrObject are copied to the new child McDBNode, and the values of these McDBAttributes exist independently.

SettingsOptional. A mcDBNodeSettings enumeration, as described in settings.

The initial value of the McDBNode.AutoSave property when a new McDBNode is being created. Otherwise, this parameter is ignored.

Settings

The settings for AddMethod are:

ConstantValueDescription
 mcdbNewNode0

Create a new McDBNode

 mcdbAlias1

Symbolically link (Alias) to an existing McDBNode

 mcdbNewNodeShareData2

Create a new McDBNode that shares the Data property of an existing McDBNode

 mcdbNewNodeShareAttributes3

Create a new McDBNode that shares the Attributes of an existing McDBNode

 mcdbNewNodeCopyData4

Create a new McDBNode, and instantiate its Data with a copy of the Data from an existing McDBNode

 mcdbNewNodeCopyAttributes5

Create a new McDBNode, and instantiate its Attribute with a copy of the Attributes of an existing McDBNode

The settings for Settings are:

ConstantValueDescription
 mcdbDefault0

The McDBNode is automatically updated in the McDBDatabase when it changes

 mcdbNoAutoSave10

Changes to the McDBNode are not written to the McDBDatabase until the McDBNode is explicitly saved

Remarks

This method returns the newly added McDBNode.

Exceptions

Error Value Description
E_ACCESSDENIED &H80070005 The McDBDatabase.LoggedUser does not have McDBRight.Write permission to the McDBNode that is the Parent of this collection.
E_INVALIDARG &H80070057 TypeOrObject does not contain a valid McDBType, McDBNode, or string name of an existing McDBType.
OLE_E_STATIC &H8004000B The instantiator of this McDBNodes is an attribute McDBNode, and its McDBNode.Children may not be changed.
E_UNEXPECTED &H8001FFFF A framework error occurred during this operation.
E_FAIL &H80004005 Either the Name specified is invalid or the McDBNode in TypeOrObject does not have any Data and AddMethod is mcdbNewNodeShareData. When this McDBNodes is an McDBNode.Children collection, Name must be unique among all of the McDBNode instances in the collection.
E_NOTIMPL &H80004001 AddMethod is mcdbNewNodeCopyAttributes, and TypeOrObject is an McDBNode with an attribute of McDBAttributeType.Type of mcdbOther.