2

i am new to ssis and i am facing an issue in script task. In my package.dtsx, i have a script task and i am assigning a variable to get the ssis variable

string strSourceFile = Dts.Variables["VaFilePath"].Value.ToString().Trim();

strSourceFile shows the file path "D:\Test" correctly. below the script task i am using data flow task to do one process and it works fine. After data flow task i am using another script task and i am assigning a variable to get the ssis variable

   string strSourceFile = Dts.Variables["VaFilePath"].Value.ToString().Trim();

but strSourceFile is empty. i am not able to figure out the reason Please help

4
  • Check the scope of each of the variables. Commented Jul 31, 2014 at 10:42
  • same ssis variable VaFilePath only i am using twice the scope is Package only, one time it works other time it doesnt, Commented Jul 31, 2014 at 10:44
  • maybe add some more info. Like more code. How your SSIS package looks like. Commented Jul 31, 2014 at 11:09
  • What is modifying your SSIS variable VaFilePath between the first Script Task and the last Script Task? Commented Jul 31, 2014 at 14:22

2 Answers 2

1

Since I cannot add a comment..

Have you check the Variable expression property that there is no expression that is changing the value.

Are you passing the variable to Script as readonly parameter? This may eliminate changing the value by mistake in the script.

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

1 Comment

I had a similar issue. Variables not showing up in "Variables." collection. I had to add (select the) variables as Readonly (in my case) in order for them to be populated in the script.
0

If your package is initiated by a controller package (for example via the "Execute Package Task"), and the controlling package binds variables to the child package, then you need to execute your child package from the context of the controlling package. i.e. if you are debugging and you execute the child task, there will be no values for package binded variables.

I'm mentioning this because I saw the same thing, and this was the reason.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.