December 2, 2008

SSIS - Script Component - Variables Access Error

I was developing an SSIS package and I encountered the following problem.
I had a OLE DB source that is providing me data from a SQL table in my data flow task. I had a script component following it. I am trying to concanctenate my one of the string column to a variable and trying to use it in other task.
So I had my code like this in my inputprocessrow method.
While Row.NextRow
myval = myval + " , " + Row.customer
End While
And i was trying to set the local variable value to my Pacakge variable collection and I encountered following error.
"The collection of variables locked for read and write access is not available outside of Post Execute", which drove me mad.

After googling for some time got this info.

You need to have a PostExecute method and try assigning it there.

Public Overrides Sub PostExecute()
Variables.Customers = myval
MsgBox("Variable Values is " + Variables.Customers)
End Sub

No comments: