locked
Event Handler Not Working RRS feed

  • Question

  • I have a simple data flow task in my package and want to implement a OnError event handler on the DFT. In event handler I have only one execute sql task to insert a record in temp table.
    My event handler never never never neever get executed... I tried all options from MSDN forums...

    There are no errors in my data flow task.
    DisableEventHandlers property of DFT is set to false.

    Now I am only concerned about any installation problems...
    I am using Visual Studio 2008 , .Net Framework3.5 SP1
    SQL server 2008


    Please help...

    Thursday, January 13, 2011 12:19 PM

Answers

  • Nitesh is correct. Event handler does not come into picture when you execute a single task. Run the entire package for the events to be fired.
    Sudeep's Domain
    • Marked as answer by me_always Monday, January 17, 2011 6:36 AM
    Friday, January 14, 2011 10:58 AM
  • But why is it so? if i want to test the event handler only on one task, then should i disable all other things in package and then run?
    It is so because when you have selected data flow task, it means only that particular task will be executed and no other task. The event handler defined on that task is another task and so it is not executed. If you want to test the handler disable all the tasks and execute the package.
    Nitesh Rai- Please mark the post as answered if it answers your question
    • Marked as answer by me_always Monday, January 17, 2011 6:36 AM
    Monday, January 17, 2011 6:15 AM

All replies

  • I'm confused by your statement.  You are saying that you never get an error in your data flow, but that you are concerned that the OnError event handler didn't fire?  Do you mean to say that you have never seen the event handler fire when an error occurs? 

    What are you trying to accomplish with the event handler?  Are you simply trying to log that the data flow encountered an error or are you attempting to log the particular data exception?  If you are attempting to log the data exception you would use the error output of the component for which you might be receiving the exception.  The OnError event handler will only fire for non-handled exceptions (i.e. the data flow turns red).

    Hope this helps!


    Please mark answered posts. Thanks for your time.
    Thursday, January 13, 2011 1:03 PM
  • There are no errors in my data flow task.
    DisableEventHandlers property of DFT is set to false.


    You mention that there are no error in your data flow task. If thats the case the even will never be trigerred.

    What do you mean by the statement that you are ony concerned about installation problems? Do you mean you want to log them. If thats the case event handlers will be of no use.


    Sudeep's Domain   Tweet me..
    Thursday, January 13, 2011 3:18 PM
  • Sorry for the confusion...

    By "There are no errors in my data flow task." I mean there arent any validation errors .

    I am purposefully failing the DFT and I want the event handler to be fired.

    To explain more, I am writing a query  in DFT as "select * from table1",  where table1 doesnot exist.

     

    Friday, January 14, 2011 5:32 AM
  • How are you executing the data flow task? Are you executing it by rt clicking it and selecting the execute option or executing the whole package? The event handler should work in case the whole package is executed.


    Nitesh Rai- Please mark the post as answered if it answers your question
    Friday, January 14, 2011 7:38 AM
  • Nitesh is correct. Event handler does not come into picture when you execute a single task. Run the entire package for the events to be fired.
    Sudeep's Domain
    • Marked as answer by me_always Monday, January 17, 2011 6:36 AM
    Friday, January 14, 2011 10:58 AM
  • OMG... Thanks Sudeep and Nitesh..

    It started working if i run entire package..

    But why is it so? if i want to test the event handler only on one task, then should i disable all other things in package and then run?

     

     

    Monday, January 17, 2011 5:23 AM
  • But why is it so? if i want to test the event handler only on one task, then should i disable all other things in package and then run?
    It is so because when you have selected data flow task, it means only that particular task will be executed and no other task. The event handler defined on that task is another task and so it is not executed. If you want to test the handler disable all the tasks and execute the package.
    Nitesh Rai- Please mark the post as answered if it answers your question
    • Marked as answer by me_always Monday, January 17, 2011 6:36 AM
    Monday, January 17, 2011 6:15 AM