SQL Server Show SSIS Data Flow OnProgress events

mfpqipee  于 4个月前  发布在  其他
关注(0)|答案(1)|浏览(54)

I have a C# windows form .exe that loads and executes an SSIS package when a button is pressed.

To show progress to the user, it has an event handler in it.

class MyEventListener : DefaultEvents
{
    public Label MyLabel;
    public override void OnProgress(TaskHost taskHost, string progressDescription,
        int percentComplete, int progressCountLow, int progressCountHigh, string subComponent, ref bool fireAgain)
    {
        MyLabel.Text = progressDescription;
        return;
    }
}


   //in the userform button onclick:
   MyEventListener eventListener = new MyEventListener();
   eventListener.MyLabel = label2;
   Microsoft.SqlServer.Dts.Runtime.Application app = new Microsoft.SqlServer.Dts.Runtime.Application();
   Package pkg = app.LoadPackage(pkgLocation, eventListener);
   DTSExecResult pkgResults = pkg.Execute(null, null, eventListener, null, null);

It works, but there's a problem. Only the Validation and Execute SQL Script tasks show the OnProgress message. I also have many Data Flow tasks, and I want them to also show their default message, like "Doing Data Flow Task 35" or whatever. What's the simplest way I can do that?

Note that I haven't configured anything regarding events in SSIS, so all these events are fired by SSIS on its own.

Note 2: I'm hoping that's there's just a checkbox somewhere I can tick. I really don't want to have to manually create Script tasks to explicilty call the events after each Data Flow, that's crazy.

Note 3: I'm not interested in saving the events anywhere, just briefly showing them in the form label.

0g0grzrc

0g0grzrc1#

I can't find what the DefaultEvent class correlates to, but if you're not seeing the Information events i.e. Doing Data Flow Task 35, then you should implement a handler for OnInformation

And as I often advise people who are writing their own SSIS package runner, to make this work on a user desktop or a web interface, you'll need to have the SSIS assemblies installed on the target machine. Those assemblies are a licensed asset of SQL Server which means you need a Standard (~8k per core, minimum 4) or Enterprise (~22k per core, minimum 4) License to be in compliance with Microsoft. In the event of an audit, since those libraries aren't easily accidentally installed, the finger wag of non-compliance is much more likely to become the fist of punitive damages

相关问题