6

I am executing an SSIS package on the command line with dtexec.exe. The package calls MessageBox.Show() and MsgBox() (C# and VB.NET, respectively) for showing errors. The boxes are hanging the automated job processor since it is waiting for the box to close.

I was under the impression that the boxes should be hidden when not in Interactive Mode. Can the message boxes be suppressed without modifying the SSIS package? The package is from a software vendor and I really shouldn't be changing it.

EDIT: The full command I am using (edited to remove details)

C:\Program Files\Microsoft SQL Server\100\DTS\Binn\DTExec.exe /F D:\Path\To\Package.dtsx /Conn DBConnection;"Provider=SQLOLEDB;Data Source=SERVER;Initial Catalog=DB;Integrated Security=SSPI;Connect Timeout=60" \Package.Variables[User::InputFileName].Properties[Value];C:\Path\To\Input.csv

EDIT2: Example of message box code. This is in a script task.

Public Sub Main()
    MsgBox("Failed to read/parse input file or generic database failure while running " + Dts.Variables("System::PackageName").Value.ToString() + ". Please check the layout of the feed and database connectivity.")
    Dts.TaskResult = ScriptResults.Failure
End Sub

EDIT3: If anyone in the future is interested in the code to test for InteractiveMode. It must also be passed in via the Script Task's ReadOnlyVariables. I ended up modifying the package since there were other issues.

VB.NET
If CBool(Dts.Variables("System::InteractiveMode").Value) = True Then
    ....
End if

C#
if ((bool)Dts.Variables["System::InteractiveMode"].Value == true)
    ....
}
Anthony Mastrean
  • 21,850
  • 21
  • 110
  • 188
merekel
  • 443
  • 5
  • 15
  • Not sure why you had the downvote and the VtC. Seems an appropriate question for the site. What does the vb/C# script look like? Is it inspecting the state of the SSIS Variable InteractiveMode? – billinkc Jun 04 '13 at 16:41
  • No it is not looking at the InteractiveMode variable. This is from a vendor so making changes is not much of an option sadly. I edited my question and put in an example of the message box call. – merekel Jun 04 '13 at 16:49
  • I dont think you can tie the package execution to the MessageBox function. IMO, you will need to modify the Script Task to prevent it from popping up the boxes. BTW, I upvoted the question to make it legit as I think the question is legit. – rvphx Jun 04 '13 at 17:24
  • I think you are right. I tried wrapping the MessageBox in a test for InteractiveMode and it works as expected now. Apparently the vendor didn't think it would ever be executed through an automated job. I'll have to discuss what our options are with my team. – merekel Jun 04 '13 at 17:32
  • 2
    The vendor builds an SSIS package with messageboxes and didn't think their SSIS package would be run through an automated job? Drop that vendor first chance you get. – Nick.Mc Jun 05 '13 at 23:25
  • I would take your entire EDIT3 and post it as an answer and then self-select it. That way you can get votes and people can see that something worked without searching through the whole timeline. – Anthony Mastrean Jun 18 '13 at 14:48

1 Answers1

0

If anyone in the future is interested in the code to test for InteractiveMode. It must also be passed in via the Script Task's ReadOnlyVariables. I ended up modifying the package since there were other issues.

VB.NET
If CBool(Dts.Variables("System::InteractiveMode").Value) = True Then
    ....
End if

C#
if ((bool)Dts.Variables["System::InteractiveMode"].Value == true)
    ....
}
merekel
  • 443
  • 5
  • 15