C# ComponentMetaData.FireError方法在SSIS脚本组件中做什么
我已经读过MSDN,但无法正确理解下面提到的方法 如果下面的代码包含在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方法允许您引发与
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