在Custom Pipeline Component中读取SSIS变量

时间:2013-04-03 12:42:43

标签: c# ssis

我正在尝试在自定义PipelineComponent

中读取包变量
public override void PreExecute()
{
            IDTSVariable100 vars2 = null;
            VariableDispenser.LockForRead("System::databse");
            VariableDispenser.GetVariables(out vars2);
}

VariableDispenser.GetVariables(out vars2)给了我错误

"The best overloaded method match for 
"Microsoft.SqlServer.Dts.Runtime.Wrapper.IDTSVariableDispenser100.GetVariables(out Microsoft.SqlServer.Dts.Runtime.Wrapper.IDTSVariables100)' 
 has some invalid argument.

1 个答案:

答案 0 :(得分:1)

嗯,除了IDTSVariableDispenser100接口是“supports the SQL Server infrastructure and is not intended to be used directly from your code”的API之一这一事实外,您已声明vars2的类型错误。 IDTSVariableDispenser100.GetVariables方法采用类型为out的{​​{1}}参数,而不是IDTSVariables100。 (注意“s”。)