2017-02-09 135 views

回答

3

创建包具有范围字符串类型的变量。 内部脚本任务,使用值填充该变量。

//get file type and store in variable filetype 

if(filetype == "Excel") 
    Dts.Variables["User::FileType"].Value = "Excel"; 

else if(filetype == "Txt") 
    Dts.Variables["User::FileType"].Value = "Txt"; 

之后,使用基于该变量值的表达式约束来调用适当的数据流任务。

对于Excel数据流的任务,优先constarint将有下面的表达式

@[User::FileType] == "Excel" 

对于文本数据流的任务,优先constarint将有下面的表达式

@[User::FileType] == "Txt" 

Expression and Precedence constraints用于控制包的执行的流程。

+0

嗨,先生,感谢您的写作,我使用相同的条件,但这两个表达式评估为false,并没有调用任何数据流任务。我应该怎么做才能使这两个条件成真 –