Search code examples
c#ssisdataflowtask

How to connect two data flow tasks in SSIS package programmatically?


I am working on a console application which generates SSIS package. I have two data flow tasks which I need to connect in a certain order. How can the tasks be connected? I guess there must be something like a path between data flow task components such as

IDTSPath100 path = dataFlowTask.PathCollection.New();
path.AttachPathAndPropagateNotifications(component1.OutputCollection[0], component2.InputCollection[0])

Thanks in advance.


Solution

  • You are looking for the package's PrecedenceConstraint collection and the Add method.

    pkg.PrecedenceConstraints.Add(dftFrom, dftTo);
    

    PrecedenceConstraints.Add Method