AddConstraint Method

DTS Programming

DTS Programming

AddConstraint Method

The AddConstraint method adds a PrecedenceConstraint object to a Step2 object.

Applies To
PrecedenceConstraints Collection
Syntax

Constraints.AddConstraint StepName

Part Description
Constraints Expression that evaluates to a PrecedenceConstraints collection
StepName Name of the step referenced by the precedence constraint

Remarks

StepName is not the name of the Step2 object to which the PrecedenceConstraint object is being added. It is the name of the step whose status or result determines when the Step2 object can be released for execution.

The AddConstraint method does not return a reference to the PrecedenceConstraint object it creates. You may need to set PrecedenceConstraint properties, PrecedenceBasis, or Value to other than their defaults.  In this case, you can create the PrecedenceConstraint object with the New method, set the properties, and then add it to the collection with the Add method. Or, you can access the PrecedenceConstraint object from the collection after creating it with AddConstraint.

Prototype (C/C++)

HRESULT AddConstraint(BSTR StepName);

Example

This Microsoft® Visual Basic® sample accesses a PrecedenceConstraint object from the collection after creating it with AddConstraint:

objStep.PrecedenceConstraints.AddConstraint "StartStep"
Set objConstraint = objStep.PrecedenceConstraints( "StartStep" )

See Also

Add Method

Creating DTS Package Workflow and Tasks

PrecedenceBasis Property

PrecedenceConstraint Object

New (Name) Method

Value Property