How to Stop Script Component Exceution when Catch block catches an error.

Answered How to Stop Script Component Exceution when Catch block catches an error.

  • Tuesday, October 09, 2012 6:34 AM
     
     

    Hi All,

    I am using Script Component in my DFT and its returnuing an exception. I have to stop the package execution when Exception raises. Please suggest.

    Thanks in advance

    Regards

    Ram


    Ram MSBI Developer

All Replies

  • Tuesday, October 09, 2012 6:53 AM
     
     Answered

    You can use FIRE Error in Catch block

    something like

    Try

    '' Your code

    Catch e

    '' Your catch handling code here

    Me.ComponentMetadata.FireError(-1, "", "ErrorOccured: " + e.Message, "", true)

    End Try


    Hope that helps ... Kunal

    • Proposed As Answer by Kunal Joshi Wednesday, October 17, 2012 11:46 AM
    • Marked As Answer by RAMMSBI Wednesday, October 17, 2012 11:52 AM
    •  
  • Tuesday, October 09, 2012 9:48 AM
     
     
    Select your DataFlawTask and in the properties window set "FailPackageOnFailure" property to True. What this does is that if the data flow task (with the script component) fails for any reason it will fail the entire package and stop execution.

    http://btsbee.wordpress.com/

  • Wednesday, October 17, 2012 11:46 AM
     
     
    any luck with the solution ??

    Hope that helps ... Kunal

  • Wednesday, October 17, 2012 11:52 AM
     
     

    Thank you very much. This solution is working fine.

    Regards

    Ram


    Ram MSBI Developer

  • Thursday, February 21, 2013 4:39 PM
     
     

    Can you please mention the your script to be used in C# ssis script component.

    Me.ComponentMetadata.FireError(-1, """ErrorOccured: " + e.Message, "", true)