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”;  

 

Advertisements

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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: