Description

Create a new attribute [value] in this McDBAttributes collection.

Return Type

None  

Syntax

object.Add Name, Type, [value], [Owner]

The Add Method syntax has these parts:

PartDescription
objectAn expression evaluating to an object of type McDBAttributes.
NameRequired. A String value.

The string name of the attribute type (McDBAttributeType) describing the new attribute [value] to be created. If this name does not indicate a [suggested] attribute (i.e. one in McDBType.Attributes of the McDBNode.Type of the McDBNode owning this collection), a [custom] McDBAttributeType with this Name and

TypeRequired. A mcDBAtbType enumeration, as described in settings.

The mcDBAtbType of the new McDBAttributeType, when a new type is being created (i.e. Name does not indicate an McDBAttributeType defined [suggested] by the parent McDBNode's McDBType). If Name indicates a pre-defined [suggested] McDBAttributeType, this parameter is unused, although some value must be provided.

valueOptional. A Variant value.

The value to assign to the new attribute. This argument will be coerced to Type, as necessary (and possible). When Type is mcdbNodeAtb, this parameter specifies the McDBType of the newly created attribute McDBNode.

OwnerOptional. A String value.

The name of the module handling the McDBAttributeType, if a new type is being created. This parameter is unused if the Name passed in argument 1 specifies a pre-defined McDBAttributeType in the owning McDBNode's McDBType.Attributes collection. If this parameter is needed, but not specified, the name of this module ("McDBLib") will be used, which is almost always appropriate anyhow.

Settings

The settings for Type are:

ConstantValueDescription
 mcdbEmpty1

No value: not valid for defining an McDBAttributeType

 mcdbOther2

A value handled by a module other than McDBLib

 mcdbLong3

A single, integral Long value

 mcdbBlob4

An array of Byte values

 mcdbDate5

A single Date value

 mcdbString6

A single String value

 mcdbDouble7

A single, real numeric (Double) value

 mcdbObject8

An OLE object

 mcdbEnum9

A discrete, pre-defined String Choice value

 mcdbNodeAtb10

A McDBNode, having its own McDBType, but no location in the McDBNode hierarchy

 mcdbArrayDouble11

An array of real, numeric (Double) values

 mcdbArrayLong12

An array of integral Long values

 mcdbArrayString13

An array of String values

Remarks

This method may NOT be used to set the value of an existing attribute. However, it MAY be used to create attributes with types not defined in the McDBNode.Type definition. That is, when Name does not specify an McDBAttributeType in the McDBType.Attributes collection of the McDBNode owning this McDBAttributes, the newly created McDBAttributeType is NOT added to the McDBType of the parent McDBNode. It is a “custom” McDBAttributeType definition. This method will trigger the NodeModified event, if it is being monitored.

Exceptions

Error Value Description
E_INVALIDARG &H80070057 An invalid mcDBAtbType value was specified for Type, there is already an attribute with the specified Name on the parent McDBNode, or the Value parameter cannot be coerced to Type.
E_UNEXPECTED &H8001FFFF A framework error occurred while creating the attribute.
E_ACCESSDENIED &H80070005 The McDBDatabase.LoggedUser does not have permission to write the parent McDBNode, or does not have the McDBRightsOwner.AttributeTypeAdminRight, if a [custom] McDBAttributeType is being created.