How to access ssis package variables inside script component

前端 未结 6 1860
旧巷少年郎
旧巷少年郎 2020-11-27 20:58

How can I access variables inside my C# code which I\'ve used in Data Flow -> Script Component - > My c# Script with my SSIS package?

I have tried with which is also

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-27 21:17

    I had the same problem as the OP except I remembered to declare the ReadOnlyVariables.

    After some playing around, I discovered it was the name of my variable that was the issue. "File_Path" in SSIS somehow got converted to "FilePath". C# does not play nicely with underscores in variable names.

    So to access the variable, I type

    string fp = Variables.FilePath;
    

    In the PreExecute() method of the Script Component.

提交回复
热议问题