2016-11-01 56 views
1

包包含脚本任务显示如下错误SSIS:DTS脚本任务遇到用户代码的异常:异常已通过调用的目标引发异常

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; 
     } 
+2

你到目前为止检查了什么?你的SSIS变量的数据类型是否与你的C#代码中使用的数据类型相匹配?您是否能够将错误缩小到特定的行? –

+0

是ssis数据类型是bool – user1254579

+1

您是将变量添加到读取还是写入集合?您可以从*脚本任务编辑器*中的*脚本*选项卡查看。 –

回答

1

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

您是否将V_Exist数据类型设置为布尔值?

相关问题