SSIS – Accessing variables from script components

 In SSIS there are are two different types of script components.  The Control Flow script, and the Data Flow script.  These 2 use different ways of accessing package variables, which was a bit confusing the first time I used teh Data Flow script component.

In the Control Flow script component you access package variables in a similar way to how DTS used to do it.

Dts.Variables("User::FromDate").Value.ToString

 However, trying this in the DataFlow script component only cause some compilation errors and nothing more.

After doing some searching, I eventually found the simple solution that was staring me in the face all along, I just never tried it.

Me.ReadOnlyVariables("User::FileName").Value.ToString()

In both cases you still have to tell the component which variables you're passing in on the property page.