在SSIS程序包中,我有一个简单的脚本来检查文件是否存在。如果没有,则流程应停止。
脚本正确返回文件,存在语句为假
并且基于当前优先级约束,只有在脚本返回value为true时,它才应该继续
这是文件存在标记以供参考
但是,程序包继续,然后失败。我不明白我在这里缺少什么或设置不正确。
编辑:添加实际脚本
public void Main()
{
string targetfile = Dts.Variables["User::FilePathLenovo"].Value.ToString();
try
{
if (File.Exists(targetfile))
{
Dts.Variables["User::FileExists"].Value = true;
}
else
{
Dts.Variables["User::FileExists"].Value = false;
}
Dts.TaskResult = (int)ScriptResults.Success;
}
catch (Exception Ex)
{
Dts.TaskResult = (int)ScriptResults.Failure;
}
MessageBox.Show("File.Exists(targetfile): " + File.Exists(targetfile));
}