DarioSantarelli.Blog(this);

SSIS: Setting a Custom Property in a Data Flow Component

Posted by dariosantarelli on July 26, 2007

If you want to set a Custom Property (like OpenRowSet) of a Data Flow Component (like an OLE DB Source) in a Data Flow Task you can use the code below:

using Microsoft.SqlServer.Dts.Runtime;
// Classes and interfaces to create Data Flow Components and automate Data Flow Tasks
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;

TaskHost MyTaskHost = (TaskHost)package.Executables[0]; // Pay attention to the ordinal number 😉
// MainPipe: wrapper to configure a Data Flow Task programmatically
MainPipe
dataFlowTask = MyTaskHost.InnerObject as MainPipe;

// Each Data Flow Task component is represented by a ComponentMetadata

IDTSComponentMetaData90 MyComponentMetadata = dataFlowTask.ComponentMetaDataCollection[“MyComponentName”];

  // Access to the Custom Property “OpenRowset”
  IDTSCustomProperty90 CustomProperty = MyComponentMetadata.CustomPropertyCollection[“OpenRowset”];
  CustomProperty.Value = “MyValue”;  

 

3 Responses to “SSIS: Setting a Custom Property in a Data Flow Component”

  1. cool said

    thank you very much!:)

  2. Josh said

    nice example mate.. perfect 😉

  3. Padmaraj said

    I’m getting error while setting “OpenRowset” for “DTSTransform.SCD” using IDTSCustomProperty100

Leave a comment