Reputation: 1958
How can I connect a SQL task to a data flow task programatically?
SQL Task:
Executable exec = package.Executables.Add("STOCK:SQLTask");
TaskHost thMainPipe = (TaskHost)exec;
...
Data flow:
MainPipe mp = ((TaskHost)stagingPackage.Executables.Add("DTS.Pipeline")).InnerObject as MainPipe;
...
Tried using PrecedenceConstraints.Add, get COM error.
PrecedenceConstraints.Add(derivedTask,(Executable) mp);
Unable to cast COM object of type 'System.__ComObject' to class type 'Microsoft.SqlServer.Dts.Runtime.Executable'.
Upvotes: 1
Views: 1013
Reputation: 776
Use STOCK:PipelineTask in place of DTS.Pipeline. Executables.Add() Method expect CLSID, PROGID, STOCK moniker, or CreationName property of the TaskInfo object. STOCK moniker is mostly used. DTS.Pipeline might not have recognized as any of them. If not using Stock Moniker, specify CLSID or PROGID equivalent to STOCK:PipelineTask.
Upvotes: 1