by robotix1986
16. July 2009 16:02
Well this entry is all code.. no explanations... you figure it out yourselves
Microsoft.SqlServer.Dts.Runtime.
Package package = new Microsoft.SqlServer.Dts.Runtime.Package();
Executable executable = package.Executables.Add("STOCK:PipelineTask");
Microsoft.SqlServer.Dts.Runtime.TaskHost thMainPipe = executable as Microsoft.SqlServer.Dts.Runtime.TaskHost;
MainPipe dataFlowTask = thMainPipe.InnerObject as MainPipe;
// Add a flat file destination component to the data flow task
IDTSComponentMetaData100 destinationComponent = dataFlowTask.ComponentMetaDataCollection.New();
destinationComponent.Name = "FlatFileDestination";
destinationComponent.ComponentClassID = "DTSAdapter.FlatFileDestination";
// Get the design time instance of the flat file destination component.
CManagedComponentWrapper destinationInstance = destinationComponent.Instantiate();
// Initialize the flat file destination component
destinationInstance.ProvideComponentProperties();
// Configure the flat file destination component to use the Flat File connection manager
destinationComponent.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.GetExtendedInterface(destinationConnection);
destinationComponent.RuntimeConnectionCollection[0].ConnectionManagerID = destinationConnection.ID;
// Configure the custom properties of the Flat File destination component
destinationInstance.SetComponentProperty("Header", "");
destinationInstance.SetComponentProperty("Overwrite", true);
// Reinitialize the metadata.
destinationInstance.AcquireConnections(null);
destinationInstance.ReinitializeMetaData();
destinationInstance.ReleaseConnections();
// ADD OTHER TASKS HERE
Hope this helps.
Regards,
AlD