I am trying to update a package variable. The package consists only of a script task and a package user variable. I have included the variable, myVar (scope: package; type: string), in the ReadWriteVariables property of the script task.
The only code I have used, in Public Sub Main, is:
Dts.Variables("myVar").Value = "2"
The package runs successfully but the variable does not change. I thought that maybe the underlying value really does change even though the value as seen in the package variables window does not (I tested this in another package/solution but it does not seem to - not even during runtime).
I also tried running the variabledispenser method but this resulted in the package running continuously until I stop debugging.
Any suggestions greatly appreciated.
Regards,
Puzzled Again
Hi, Create a local (within script) variable that is a copy pacakge. The following is how I populate a variable in a parent package(failflag), from a variable in a child package(childfailvalue). This script in the child package.
Dim localfailflag As Variable = Dts.Variables("failflag")
Dim localchildfailvalue As Variable = Dts.Variables("childfailvalue")
localfailflag.Value = localchildfailvalue.Value
Thanks Craig. I tried your code but it didn't work...probably because I didn't include other parts of code that were required.
I changed the routine to using an Execute SQL Task to update the package variable and this seems to have worked.
Regards,
Puz
No comments:
Post a Comment