在调试期间监视 SSIS 中的变量

我在 SSIS 中有一个项目,我已经添加了一个执行 SQL 任务,它将其结果发送给一个变量。我想确认这个值,因为我担心它会试图将它写出来作为一个结果集对象,而不是一个实际的整数(在这种情况下,我返回一个 COUNT)。

我的第一个想法就是在调试模式下运行它,并将全局变量添加到我的 Watch 窗口中。不幸的是,当我右键单击“监视”窗口时,“添加变量”选项变成了灰色。我错过了什么?

我已经确认了我的变量设置是正确的,所以我对放入一个脚本来执行带有该值的 MsgBox 之类的方法不感兴趣。作为将来的参考,我希望能够在调试模式下观察变量。如果有一些限制,那么我想知道是什么,为什么这一切,如果有人知道。

可悲的是,这个帮助是不够的,每一个“教程”,我可以找到只是说,“添加变量到监视窗口和调试”,仿佛这样做应该永远不会有问题。

谢谢你的建议!

171340 次浏览

I believe you can only add variables to the Watch window while the debugger is stopped on a breakpoint. If you set a breakpoint on a step, you should be able to enter variables into the Watch window when the breakpoint is hit. You can select the first empty row in the Watch window and enter the variable name (you may or may not get some Intellisense there, I can't remember how well that works.)

Drag the variable from Variables pane to Watch pane and voila!

I know this is very old and possibly talking about an older version of Visual studio and so this might not have been an option before but anyway, my way would be when at a breakpoint use the locals window to see all current variable values ( Debug >> Windows >> Locals )

Visual Studio 2013: Yes to both adding to the watch windows during debugging and dragging variables or typing them in without "user::". But before any of that would work I also needed to go to Tools > Options, then Debugging > General and had to scroll right down to the bottom of the right hand pane to be able to tick "Use Managed Compatibility Mode". Then I had to stop and restart debugging. Finally the above advice worked. Many thanks to the above and to this article: Visual Studio 2015 Debugging: Can't expand local variables?