2

我有一个 ForEach 循环容器,它应该遍历 Ado 枚举器中的记录。编号模式 = 第一个表中的行。

我构建了一个脚本任务来为每次迭代编写一个 MessageBox。它仅显示第一次迭代的消息。之后它挂起。

我尝试构建解决方案并运行包,它工作正常。但在开发/设计领域它仍然挂起。

这就是它应该在设计模式下工作的方式吗?如果在调试时它会挂起,我该如何测试 Foreach 容器下游的东西?

4

3 回答 3

3

When SSIS is running in Visual Studio/BIDS/SSDT and it just seems to hang, especially if there's a script task, look at the task bar. 11/10 a dialog has popped up indicating you have an error in your code.

As you are popping message boxes, the first one will get focus as it opens but the subsequent ones do not automatically gain focus.

My personal preference is to FireInformation events over message boxes as they work whether the process is running in attended versus unattended mode. Example over here

于 2016-05-24T14:04:21.760 回答
0

不,ForEachLoop在设计模式下的工作方式与部署到服务器时的工作方式相同。如果您看到它只迭代一次,那么最可能的解释是只有一项需要迭代,并且您的数据不是您认为的那样。

正如评论中所建议的那样,您可以在循环之前和/或期间的某个点上放置一个断点,并使用 Watches 来查看您的变量以查看它们的值是什么。这应该可以让您了解为什么您的 ADO 对象只包含一个项目。

于 2016-05-24T13:37:07.060 回答
0

我也遇到了这个,我让它工作了。

  1. 确保将您的变量放在 ReadOnlyVariable 字段中 - 您要在脚本任务内的消息框中显示的字段。
  2. 在脚本任务中注释或删除此语句:Dts.TaskResult = (int)ScriptResults.Success; 我认为它会影响过程,因为它给出了成功的结果。

希望能帮助到你。

于 2018-07-02T10:12:30.610 回答