I want to stop a package (I think the only way to do it is via script task) when the current package generates an error.
Anyway, I'm not familiar with VB that much and I found this method of stopping a package. I've tried to use it below
Public Sub Main()
' Add your code here
Dim pkg As RunningPackage
Dts.TaskResult = ScriptResults.Success
but I get an error message
Variable 'pkg' is used before it has been assigned a value. A null reference exception could result at runtime
Can anyone help me to write the correct syntax.
-PS I'm using this within the On Error event handler.