在腳本組件[Input0_ProcessInputRow]中,我試圖讀取「ReadWrite」全局變量值並拋出錯誤。無法在SSIS的腳本組件中獲取「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
請幫忙嗎?
我嘗試這樣做,現在能夠訪問。 http://stackoverflow.com/questions/13450289/how-to-access-ssis-package-variables-inside-script-component – VHK
http://stackoverflow.com/questions/13450289/how-to-access- ssis-package-variables-inside-script-component – VHK
我有類似的問題,但不知道如何解決它?你提供了一個鏈接,但我沒有接受這個頁面上的答案,他們是相似的!你能給我們一個答案嗎?或者接受提供的答案,如果它是你所嘗試的? – Yahfoufi