有没有办法在C#中中止ETL执行?

时间:2014-08-01 15:00:03

标签: sql-server ssis

我有关于如何在C#中执行ETL的示例

var app = new Application();
var pkg = app.LoadPackage(pkgLocation, null);
var vars = pkg.Variables;
var pkgResults = pkg.Execute(null, vars, null, null, null);
if (pkgResults == DTSExecResult.Success)
    Console.WriteLine("Package ran successfully");
else
    Console.WriteLine("Package failed");

它运作正常,但现在我需要的不仅仅是结果。我需要中止当前的执行,有没有办法像pgk.Abort()那样做?

感谢...

1 个答案:

答案 0 :(得分:1)

根据Package Class documentation,您可以像这样致电SuspendExecution()

pkg.SuspendExecution();