SSIS:Dts脚本任务在用户代码中遇到异常:调用目标抛出了异常

时间:2016-11-01 11:59:28

标签: c# sql-server ssis ssis-2012 ssis-2008

包中包含脚本任务,显示错误

Dts Script task has encountered an exception in user code:
Exception has been thrown by the target of an invocation

脚本任务代码是

public void Main()
        {
            string Str_Filepath = Dts.Variables["User::FilePath"].Value.ToString();

            bool bl_exist=false;


            if (System.IO.File.Exists(Str_Filepath))
            {
                bl_exist = true;


             }
             else
            { bl_exist = false; }

            Dts.Variables["User::V_Exist"].Value = bl_exist;


            Dts.TaskResult = (int)ScriptResults.Success;
        }

1 个答案:

答案 0 :(得分:1)

这只是意味着代码有错误。

您是否将V_Exist数据类型设置为boolean?