2

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

4
  • Make sure to mark the variables as Read/Write and not just as ReadOnly on the script component. Commented Jan 16, 2019 at 11:31
  • All variables were readwrite Commented Jan 16, 2019 at 11:54
  • Check if your variable is set to "Evaluate as expression" on the Properties tab (F4). Undo if so. Commented Jan 16, 2019 at 11:56
  • EzLo I have updated my question, please check and confirm Commented Jan 16, 2019 at 12:01

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.