Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/284.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# ComponentMetaData.FireError方法在SSIS脚本组件中做什么_C#_Sql Server 2008 R2_Ssis - Fatal编程技术网

C# ComponentMetaData.FireError方法在SSIS脚本组件中做什么

C# ComponentMetaData.FireError方法在SSIS脚本组件中做什么,c#,sql-server-2008-r2,ssis,C#,Sql Server 2008 R2,Ssis,我已经读过MSDN,但无法正确理解下面提到的方法 如果下面的代码包含在SSIS脚本目标组件中,它会做什么 bool Error = false; this.ComponentMetaData.FireError(0, "myScriptComponent", "`A Transformation error occurred. Check the corresponding Text File ", "", 0, out Error);` FireError方法允许您引发与

我已经读过MSDN,但无法正确理解下面提到的方法

如果下面的代码包含在SSIS脚本目标组件中,它会做什么

bool Error = false;
this.ComponentMetaData.FireError(0, "myScriptComponent", 
    "`A Transformation error occurred. Check the corresponding Text File ", 
    "", 0, out Error);`

FireError方法允许您引发与SSI中其他地方使用的内置错误处理方法一致的错误。也就是说,上面的代码引发了一个由OnError事件拾取的错误

遵循FireError方法的参数在BOL中描述

这可以用来提供足够的错误处理(在编写任何自定义代码时都应该这样做)。例如:

除了.FireError,还有另外的.Fire。。。方法允许您触发SSI将拾取的类似事件,例如,FireInformation允许您将消息写入输出窗口

Try

   'Your Code Here

Catch

   'Error handling here
   Me.ComponentMetadata.FireError(...)

end try