August 30, 2014 at 5:54 am
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.
August 30, 2014 at 6:35 am
Quick thought, rather than a iterative for loop use foreach table in tables.
😎
August 30, 2014 at 6:46 am
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:-)
August 30, 2014 at 7:09 am
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