Click here to Skip to main content
15,886,699 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to pass expressions to the variables set to existing package in ssis using c# programatically for flat file source component.


I am having source(Flat file) mapped to destination (SQL server DB). Source Path is to be dynamically set.


I am able to pass the expressions but needs to pass the expression value evaluated to the source component variable.

What I have tried:

Code is as below:
// Using the CLSID
Executable exExpressionTask = 
pkg.Executables.Add("Microsoft.SqlServer.Dts.Tasks.ExpressionTask.ExpressionTask, Microsoft.SqlServer.ExpressionTask, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91");
TaskHost thExpressionTask = exExpressionTask as TaskHost;
ExpressionTask expressionTask = thExpressionTask.InnerObject as ExpressionTask;

// Set the expression.
expressionTask.Expression = @"10>0";

// Get the expression.
string expression = expressionTask.Expression;

// Validate the expression.
string str = expressionTask.ValidateExpression(null);
Posted
Updated 4-Apr-18 2:58am

1 solution

Make sure the variable is specified as a ReadWriteVariable in the package so the script can modify it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900