posted 1/6/2012 by BillBrannen - Views: [1652]
I’ve noticed a lot of people, myself included, use a message box to display the values of script variables for debugging purposes. However, there are several drawbacks to using a message box. It stops the execution of the script and must be dismissed so the script can continue. Sometimes the message box will even be hidden by other windows making you think the script is still running. As an alternative, you can write the value of your variable to the Execution Results tab and the Output window with the following code inside your script task.C# Example
bool fireAgain = false;string fullName = "John Smith";this.Dts.Events.FireInformation(1, "My C# Message", fullName, "", 0, ref fireAgain);VB Example
Dim fullName As String = "George Jones"Me.Dts.Events.FireInformation(1, "My VB Message", fullName, "", 0, False)
The following images show the resulting output in the Execution Results tab and the Output window.
Execution Results Tab
Output Window