SSIS スクリプト タスクから呼び出すクラス ライブラリを VB.NET で作成しました。
文字列値を返すはずだったVB.NET関数からエラーを返す方法を教えてくださいnull
。その場合、SSISスクリプトタスクを失敗させたいと思います。
関数ライブラリから例外 / Null がスローされた場合、次のコードを使用してパッケージを失敗させることができます。YourMethodCall() をメソッドに置き換えます。
// For General exceptions
try
{
// Your Method call
var x = YourMethodCall();
if (string.IsNullOrEmpty(x))
{
Dts.Events.FireError(0, "Your component Name", "Your Error Message", string.Empty, 0);
}
else
{
bool isFireAgain = false;
Dts.Events.FireInformation(0, "You component Name", "Your Information for Successful run", string.Empty, 0, ref isFireAgain);
}
}
catch (Exception ex)
{
Dts.Events.FireError(0, "Your component Name", String.Format("Failed and Exception is : [{0}]",ex.Message), string.Empty, 0);
}
お役に立てれば!