我使用C#进行VS 2008综合服务项目。 该项目有两个包:
Package.dtsx
variable MyStuff int 99
Execute package task with a file connection to Package1.dtsx
Package1.dtsx
variable MyStuff int 0
Package Configuration:
Config Name - Configuration 1
Config Type - Parent package variable
Config String - MyStuff
Target Object - MyStuff
Target Property - Value
Script Task with a readwritevariable User::MyStuff
public void main(){
MessageBox.Show(Dts.Variables["MyStuff"].Value.ToString());
Dts.TaskResult = (int)ScriptResults.Success;
}
我构建了脚本任务和解决方案。当我调试'消息框出现的项目,但具有子变量的值。我如何获得父变量的值?
答案 0 :(得分:0)
我在Script Task(C#)中使用了Variables集合和VariableDispencer:
变量var = null;
Dts.VariablesDispencer.LockForRead( “用户:: ParentVariable”); Dts.VariablesDispencer.GetVariables(ref var);
String localVariable = var [“User :: ParentVariable”]。Value.ToString();