tags:

views:

65

answers:

2

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?

+4  A: 

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);
dtb
+4  A: 

You need the ref keyword:

bool b = true;
Dts.Events.FireInformation(99, "test", "Make this event appear!", "", 0, ref b);
Fernando