Smart003
Smart003

Reputation: 1119

unable to assign updated value to ssis variable using script task

I created some variables and using the C# script task I am trying to modifying the values of the variables. initial values

Expression Builder image for pine variable

enter image description here FolderInputPath="D:\"; Pine="C:\abc\qwr";

please find the variable status

enter image description here

the above values were set at the variables in ssis package

string filename = "";
string newname="";
filename = Dts.Variables["User::FolderInputPath"].Value.ToString();

if (filename.Substring(filename.Length - 1, 1) != "\\")
{
    filename = filename + "\\";
}

newname = filename + "Pine.txt";
Dts.Variables["User::Pine"].Value = newname;
MessageBox.Show(newname + "     before value is " + Dts.Variables["User::Pine"].Value.ToString());

As per the above logic we User::Pine should have the value "D:\Pine.txt" but when i run the code the value for the variable User::Pinedoesn't change

enter image description here

thanks in advance

Upvotes: 2

Views: 3836

Answers (1)

EzLo
EzLo

Reputation: 14189

Open the variable pane, click on your variable and press F4 to open the Properties window.

Make sure that "EvaluateAsExpression" and "ReadOnly" are both set to False. Also make sure that the "Expression" field is empty (like the following image). If it's not, select it's text and delete it.

![enter image description here

Upvotes: 2

Related Questions