April 30, 2008 at 4:48 am
I have a simple project consisting of a single data flow task which reads a flat file as source, changes the record layout slightly by means of a script component, and then outputs another flat file. There are about 16,000 records in the input and then it gets stuck about two-thirds of the way through throwing up the following message:
The collection of variables locked for read and write access is not available outside of Post Execute. Error code 0x80131600.
I am using one global variable which I have defined in the Variables section of the package.
What is causing this and how do I fix it ?
May 1, 2008 at 7:58 am
May 6, 2008 at 7:05 am
Hi Peter,
Thanks for your contribution towards me solving this problem. From the info provided in the link I did some research into the VariableDispenser parameter, which apparently is what I need to lock the variable prior to reading from it or writing to it. I used the following code in my script component:
Dim SavedBatchNo As String
If Row.RecCode = "DEPH" Then
VariableDispenser.LockForWrite(SavedBatchNo)
VariableDispenser.GetVariables(SavedBatchNo)
SavedBatchNo = Row.DepBatchNo
Else
If Row.RecCode = "DEPD" Then
VariableDispenser.LockForRead(SavedBatchNo)
VariableDispenser.GetVariables(SavedBatchNo)
Row.StBtchNo = Variables.SavedBatchNo
End If
End If
There is something wrong with the value coming after GetVariables because it is giving the following message:
Option Strict On disallows implicit conversions from 'String' to 'Microsoft.SqlServer.Dts.Runtime.Wrapper.IDTSVariables90'
Can you provide some insight please ?
July 2, 2008 at 11:29 am
I'm sure you've moved on by now, but looks like you are trying to pass a string into to the getavariables in order to retreive the one you want. Your code should be more like this as far as I can tell...
Dim vars As Variables
Dts.VariableDispenser.LockForWrite(SavedBatchNo)
Dts.VariableDispenser.GetVariables(vars)
Try
vars(SavedBatchNo).Value = varValue
Catch ex As Exception
Throw ex
Finally
vars.Unlock()
End Try
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply