zoukankan      html  css  js  c++  java
  • SSIS ->> Event Handler

    Event Handler支持在某个事件触发的时候定义好处理该事件的逻辑,比如错误事件触发是该怎么处理。它跟Control Flow界面相似,就好像执行了另外一个包一样。Event Handler不仅支持包内的task对象,还支持对Event Hanlder事件中的task。

    Event Handler可以触发组件级别或者包级别的事件,包括

    FireBreakpointHit:这个一般应该用在调试时;
    FireError:错误发生时,这个也应该是最被常用到的;
    FireInformation:信息级别的
    FireProgress:这个不知道怎么理解,我理解它就像VBA中的OnCurrent事件一样,就是没有错误,差不多开始执行组件的代码时被触发
    FireQueryCancel:书上解释是触发一个事件以决定包是否需要被停止
    FireCustomEvent:自定义事件
    FireWarning:高于Information,低于Error的事件

    其实除了上面这些还有一些比如OnPreValidate、OnPostValidate、OnPreExecute、OnPostExecute

    public void Main()
    {
    string taskName = Dts.Variables[“System::TaskName”].Value.ToString();
    bool retVal = false;
    Dts.Events.FireInformation(0, taskName, String.Format
    (“Starting Loop Operation at {0} “,
    DateTime.Now.ToString(“MM/dd/yyyy hh:mm:ss”)), “”, 0,
    ref retVal);
    for(int i=0; i <= 10; i++)
    {
    Dts.Events.FireProgress(String.Format(”Loop in iteration {0}”, i),
    i * 10, 0, 10, taskName, ref retVal);
    }
    Dts.Events.FireInformation(0, taskName, String.Format(”Completion Loop Operation
    at {0} ”, DateTime.Now.ToString(”mm/dd/yyyy hh:mm:ss”)), ””, 0, ref retVal);
    Dts.Events.FireWarning(1, taskName, ”This is a warning we want to pay attention
    to...”, ””, 0);
    Dts.Events.FireWarning(2, taskName, ”This is a warning for debugging only...”,
    ””, 0);
    Dts.Events.FireError(0, taskName, ”If we had an error it would be here”, ””, 0);
    }

     

  • 相关阅读:
    Java连接数据库 #02# JDBC经典套路
    Eloquent JavaScript #03# functions
    Java笔记 #04# 类的初始化顺序补充
    Java笔记 #03# HtmlUnit爬虫
    Google's Machine Learning Crash Course #04# First Steps with TensorFlow
    IntelliJ IDEA. Debug模式
    python实用笔记,加快编程速度,lamdba,三元运算,open.
    开源项目管理平台*redmine*的架设
    MYSQL双主故障解决实例。
    LVS-DR工作原理
  • 原文地址:https://www.cnblogs.com/jenrrychen/p/4550065.html
Copyright © 2011-2022 走看看