Skip to content

Instantly share code, notes, and snippets.

Created January 23, 2016 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/cf293501061bcb739a93 to your computer and use it in GitHub Desktop.
Save anonymous/cf293501061bcb739a93 to your computer and use it in GitHub Desktop.
// Do-nothing variable required for FireInformation below
bool fireagain = true;
// Log output to SSIS log
if (returnVal != 0 || errStr.Length > 0) // Error
{
if (errStr.Length > 0)
Dts.Events.FireError(0, "WinSCP Exception", errStr.Replace("'", "\"").Replace("--", " - "), "", 0);
if (outStr.Length > 0)
Dts.Events.FireError(0, "WinSCP error", "A WinSCP error has occurred. The full output stack follows: " + outStr.Replace("'", "\"").Replace("--", " - "), "", 0);
}
else // No error
Dts.Events.FireInformation(0, "WinSCP output", outStr, string.Empty, 0, ref fireagain);
Dts.TaskResult = (returnVal != 0) ? (int)ScriptResults.Failure : (int)ScriptResults.Success;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment