Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firing events in script task

Tags:

c#

ssis

I've got an SSIS project where I am constructing an SQL command based on some variables. I'm constructing the command in a script task, and want to output the constructed SQL to the 'Execution Results' window. I am trying to do this using a FireInformation line from inside my script as follows:

Dts.Events.FireInformation(99, "test", "Make this event appear!", "", 0, true);

However, in the script editor when editing ScriptMain.cs, that line is underlined in red, and on mouseover, I get the following message:

Error:
The best overloaded method match for 'Microsoft.SqlServer.Dts.Tasks.ScriptTask.EventsObjectWrapper.FireInformation(int, string, string, string, int, ref bool') has some invalid arguments

As a result, my script does not compile and I cannot execute it.

Any idea what I'm doing wrong here, or what I need to change to be able to see the values of my variables at this point in the Execution output?

like image 880
Anonymouslemming Avatar asked Jun 14 '10 13:06

Anonymouslemming


2 Answers

The last parameter of IDTSComponentEvents.FireInformation is a ref bool, not a bool.

So you need to pass a reference to a variable of type bool instead of a bool value:

bool fireAgain = true;
Dts.Events.FireInformation(..., ref fireAgain);
like image 104
dtb Avatar answered Nov 12 '22 03:11

dtb


You need the ref keyword:

bool b = true;
Dts.Events.FireInformation(99, "test", "Make this event appear!", "", 0, ref b);
like image 44
Fernando Avatar answered Nov 12 '22 04:11

Fernando