programmatic creation of a list of data flow tasks in SSIS

  • Hi Everybody.

    I am writing some code to generate a customised SSIS package. I've used the following code for generating PipelineTask components:

    for (int i = 0; i < Math.Ceiling(tables.Count * 1.0 / cnt * 1.0); i++)

    {

    if (i > 0)

    {

    prevTsk = tsk;

    }

    tsk = package.Executables.Add("STOCK:PipelineTask");

    //tsk = package.Executables;

    // Get the task host wrapper, and the Data Flow task

    TaskHost taskHost = tsk as TaskHost;

    MainPipe dataFlowTask = (MainPipe)taskHost.InnerObject;

    if (i > 0)

    {

    //prevTsk = package.Executables[i-1];

    PrecedenceConstraint pcPipelineTask =

    package.PrecedenceConstraints.Add((Executable)prevTsk, (Executable)tsk);

    }

    ...

    The above code works fine in creating a number of DataFlow tasks. But if we uncomment the two commented lines the app behaves very strange. But there would not be any difference between them I suppose. Does anybody know why using package.Executables and package.Executables[i-1] does not generate the expected result? does it have anything to do with COM objects and initialisation?

    Thanks in advance.

  • Quick thought, rather than a iterative for loop use foreach table in tables.

    😎

  • Eric the loop in this level does not iterate the tables or any other Enumeration. It is just a simple loop.

    the tables' loop sits below the code shown:-)

  • Mr.Sahand (8/30/2014)


    Eric the loop in this level does not iterate the tables or any other Enumeration. It is just a simple loop.

    the tables' loop sits below the code shown:-)

    He he, "missed" that part:-D

    😎

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply