- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在脚本组件 [Input0_ProcessInputRow] 中,我尝试获取“ReadWrite”全局变量值,但它抛出以下错误。
错误:
The collection of variables locked for read and write access is not available outside of PostExecute.
下面是我的代码
If Row.Column13 = "C" Then
Variables.mTotalCreditCount = Variables.mTotalCreditCount - 1
Variables.mTotalCreditAmount = Variables.mTotalCreditAmount - CDbl(Row.Column14)
ElseIf Row.Column13 = "D" Then
Variables.mTotalDebitCount = Variables.mTotalDebitCount - 1
Variables.mTotalDebitAmount = Variables.mTotalDebitAmount - CDbl(Row.Column14)
End If
我还尝试读取局部变量中的值,然后在 PostExecute() 中分配给全局变量,如下所示。没有运气
If Row.Column13 = "C" Then
mTotalCrCnt = Variables.mTotalCreditCount - 1
mTotalCrAmt = Variables.mTotalCreditAmount - CDbl(Row.Column14)
ElseIf Row.Column13 = "D" Then
mTotalDbCnt = Variables.mTotalDebitCount
mTotalDbCnt = mTotalDbCnt - 1
mTotalDbAmt = Variables.mTotalDebitAmount
mTotalDbAmt = mTotalDbAmt - CDbl(Row.Column14)
End If
Public Overrides Sub PostExecute()
MyBase.PostExecute()
Variables.ProcessCount = intProcessCount
Variables.mTotalCreditCount = mTotalCrCnt
Variables.mTotalCreditAmount = mTotalCrAmt
Variables.mTotalDebitCount = mTotalDbCnt
Variables.mTotalDebitAmount = mTotalDbAmt
End Sub
请问有什么帮助吗?
最佳答案
查看您的评论,看起来您已经解决了问题,但我发布此答案是为了提供有关如何在 SSIS 脚本中使用变量以及如何解决类似问题的信息,因此它可以帮助其他人用户
SSIS 变量
变量存储可在所有 SSIS 组件和容器中使用的值。
Integration Services supports two types of variables: user-defined variables and system variables. User-defined variables are defined by package developers, and system variables are defined by Integration Services. You can create as many user-defined variables as a package requires, but you cannot create additional system variables. More info in this MSDN article
在脚本组件中使用变量
每个脚本都有一个可以在脚本页面上定义的 ReadOnlyVariables
和 ReadWriteVariables
列表。
只读变量
ReadOnlyVariables
可以从所有脚本 Sub 访问,并且正如其名称一样,它们是只读
。
读写变量
The collection of ReadWriteVariables is only available in the
PostExecute
method to maximize performance and minimize the risk of locking conflicts. Therefore you cannot directly increment the value of a package variable as you process each row of data. Increment the value of a local variable instead, and set the value of the package variable to the value of the local variable in the PostExecute method after all data has been processed. You can also use the VariableDispenser property to work around this limitation. However, writing directly to a package variable as each row is processed will negatively impact performance and increase the risk of locking conflicts. More in this MSDN article
使用变量的方法
有 3 种使用变量的方法:
ReadOnlyVariables
或 ReadWriteVariables
后直接访问它们使用变量分配器(LockForRead
和 LockForWrite
方法)
IDTSVariables100 vars = null;
VariableDispenser.LockForRead("User::MyVariable");
VariableDispenser.GetVariables(out vars);
string TaskName = vars["User::MyVariable"].Value.ToString();
vars.Unlock();
使用 SSIS 日志记录任务:读取变量并将其记录到执行日志、消息框或文件
有很多文章讨论这个方法,你可以引用它们来了解更多
关于sql-server - 无法在 SSIS 的脚本组件中获取 "ReadWrite"变量值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42687860/
我发现了一些奇怪的事情:我有一个带有两个数据网格的表单,它们绑定(bind)到同一个集合。根据 Xaml 中数据网格的顺序,行为会有所不同。 这按预期工作(存在用于添加的额外行):
我正在尝试使用单个帐户作为代理来管理多个 Outlook 日历,因此所有其他帐户都与此“主”帐户共享其个人日历,并且在这个帐户中我可以“为所有人”添加、编辑或删除事件. 问题是我无法让帐户向应用程序授
我正在尝试代表用户创建 session ,因为我正在尝试获取代码。我已在 Azure 上注册了该应用程序。还生成了应用程序(客户端)ID 我还在 API 中添加了所需的权限。但是,当我访问此页面时,页
我怎样才能实现这一目标 类中的内部实现必须读写属性 对于类实例的外部交互,属性必须是只读的 最佳答案 在 Objective-C 中: 我的对象.h @interface MyObject : NSO
我正在运行 python 2.7 和 mongodb 2.6.5。我无法让我的 mongoengine 连接并发出请求,但我可以使用用户登录 mongo 并发出相同的请求。我像这样在 mongodb
我正在开发一个包含 Skype for Business Online Web SDK 的应用程序。我注意到无法访问有关登录用户的 Skype 帐户/个人资料的信息(通过 Skype 的 mePers
在脚本组件 [Input0_ProcessInputRow] 中,我尝试获取“ReadWrite”全局变量值,但它抛出以下错误。 错误: The collection of variables loc
我正在将一些代码从 Windows 移植到 Linux (Ubuntu 9.10)。我有一个简单的类(请参见下文),它使用 Windows 函数来实现简单的互斥锁定。我想使用 Boost.Thread
当返回 DocumentClient AsReliable 时,它没有 PartitionResolvers。有什么办法可以解决这个问题? var documentClient = new Docum
我有一个具有 readwrite int 属性的类: @interface PlayScene : UIView @property (readwrite, assign) int Figure1;
我正在尝试在 Numpy 数组上逐行迭代。该数组是通过 PyO3 访问的,我认为库对底层 C 对象的访问很好,但我似乎找不到更复杂的 SingleIteratorBuilder 的引用,它可以帮助我按
我在使用 IndexedDB 的应用程序上收到此警告。 “IDBDatabase.transaction 中不推荐使用数字事务模式。使用“readonly”或“readwrite”” 当我第一次编写应
JMX 允许您在名为 jmxremote.access 的文件中为用户设置访问权限。 (您可以在 /jre/lib/management 中找到模板)。在那里你可以为每个用户指定如果用户有..
我移动了这一行: @property (nonatomic, retain) IBOutlet UIWindow *window; 进入我的 App Delegate 中的类扩展,但现在出现此错误:
更新:我已经收到Microsoft的通知,该问题是Graph API中的错误。他们正在研究解决方案。 我正在使用新的O2.0 v2.0 OAuth流程对我的应用进行身份验证以与Microsoft Gr
在 MongoLab 中,您生成一个 API key ,然后任何人都可以使用 REST API 访问您的数据库。 通常的情况是直接从 Ajax 客户端使用 REST api。 但这使任何人都可以完全写
我因不同的权限 Device.ReadWrite.All 遇到此错误。我正在尝试使用授权代码授予工作流程获取访问 token ,但出现此错误。如果我使用客户端凭据授予工作流程,我就能够接收 token
我理解协变和逆变。我也读过 Eric Lippert 的优秀文章 here . 但是,我无法理解标准库中以下接口(interface)的方差的实际应用,这些接口(interface)是编写自定义委托(
我因不同的权限 Device.ReadWrite.All 遇到此错误。我正在尝试使用授权代码授予工作流程获取访问 token ,但出现此错误。如果我使用客户端凭据授予工作流程,我就能够接收 token
我已经阅读了一些关于 ARC 的教程,但对属性声明仍然有些困惑。我使用以下模式编写了大部分代码: @property (readwrite, nonatomic) PlayerData* player
我是一名优秀的程序员,十分优秀!