Description

Delete this McDBNode.

Return Type

None  

Syntax

object.Delete [RefRules]

The Delete Method syntax has these parts:

PartDescription
objectAn expression evaluating to an object of type McDBNode.
RefRulesOptional. A mcdbDeleteRefRules enumeration, as described in settings.

The rules/behavior to follow when an ambiguous deletion condition arises during this operation.

Settings

The settings for RefRules are:

ConstantValueDescription
 mcdbAlwaysUseReferenceList0

Referential integerity rules are always honored. This operation will fail unless all referenced and referencing nodes can be loaded and updated with the change. The operation will also fail if there is still an entry in this CMcDBNode's referencers list.

 mcdbAlwaysDeleteMe1

Referential integrity rules are not honored for deletion of this CMcDBNode ONLY. This operation will fail as in mcdbAlwaysUseReferenceList, except that the operation will succeed even if there is still an entry in this CMcDBNode's referencers list.

 mcdbAlwaysDeleteForeignRef2

Referential integrity rules are not honored when deleting foreign references. That is, a reference to a foregin node is always successfully removed, even if the foreign node cannot be loaded for update. However, this operation will fail if there is still an entry in this CMcDBNode's referencers list.

 mcdbAlwaysDeleteChildren4

Referential integrity rules are not honored when deleting the referenced children of this CMcDBNode. That is, the child node(s) of this CMcDBNode are deleted even if there are still entries in their referencers list.

 mcdbNeverDeleteForeignNode8

Referential integrity and recursion rules are not honored when dealing with foreign references. A reference to a child McDBNode that is foreign will always be deleted, but its database never opened and the referenced McDBNode never deleted nor updated, thereby orphaning the backwards links to this McDBNode in the child's Referencers collection.

Remarks

This method is an alternative to calling McDBNodes.Remove() on Parent of this McDBNode. Errors and ambiguous conditions that may arise from referential integrity concerns are handled by the RefRules parameter.

Exceptions

Error Value Description
OLE_E_CANT_BINDTOSOURCE &H8004000A There is an McDBTransaction running and the McDBDatabase containing this McDBNode is participating in an McDBQuery.
E_FAIL &H80004005 A framework error occured obtaining the hierarchy tree rooted at this McDBNode.
E_UNEXPECTED &H8001FFFF A framework error occurred during this operation.
E_ACCESSDENIED &H80070005 The McDBDatabase.LoggedUser does not have McDBRight.Delete privileges to this McDBNode or an McDBNode in its hierarchy subtree or does not have McDBRight.Write privileges to Parent.

Notes

When an McDBNode is Deleted it is immediately unloaded from memory, and any remaining references held will fail to work (i.e. the IsValid property will return False). For database integrity, this method is internally transacted, making it an atomic (all or nothing) operation. If Delete fails for any reason, nothing is done. If this call is aborted by responding to the BeforeNodeDelete event with Cancel, this method does not report an error and nothing is done.