error SSIS script
Hello, I'am working with a script component in SSIS 2005, i have a variable which i use in my package, i want to call this variable in my script to increment it as many times of number of entry lines in my dataset. I do this script Public Class ScriptMain Inherits UserComponent Dim Counter As Integer Public Sub New() ' 'Initialise the variable Counter = Me.Variables.vNNN006 ' 'MsgBox(Counter) 'End Sub Public Overrides Sub Entre0_ProcessInputRow(ByVal Row As Entre0Buffer) ' ' Add your code here ' Counter = Me.Variables.vNNN006 Counter += 1 Row.EDOCS = Counter 'MsgBox.Show(Counter.ToString()) MsgBox(Counter) End Sub End class But when i execute i have this exception Erreur de validation. Tche de flux de donnes*: Composant Script [296]*: System.Reflection.TargetInvocationException: Une exception a t leve par la cible d'un appel. ---> Microsoft.SqlServer.Dts.Pipeline.ReadOnlyVariablesNotAvailableException: La collection de variables verrouille pour l'accs en lecture n'est pas disponible ce stade. Microsoft.SqlServer.Dts.Pipeline.ScriptComponent.get_ReadOnlyVariables()... I don't understand this, i don't have error in my script Can someone help me please
June 12th, 2012 8:49am

It seems the variables aren't available. Did you configure them in the properties of the script component? This blog lists all the steps to work with variables in a script component: http://microsoft-ssis.blogspot.be/2011/01/how-to-use-variables-in-script.htmlMCTS, MCITP - Please mark posts as answered where appropriate.
Free Windows Admin Tool Kit Click here and download it now
June 12th, 2012 9:01am

For Accessing variable inside script component for example create some variable var1 for package level then this variable inside script component can be called using private int var_scrpt= 0; if (ReadOnlyVariables.Contains("var1 ") == true) { var_scrpt= Convert.ToInt32(ReadOnlyVariables["var1 "].Value.ToString()); }karteek_miryala
June 12th, 2012 9:05am

Did you set the variable as ReadWrite for your script component. Check his example: http://www.programmersedge.com/?p=1350
Free Windows Admin Tool Kit Click here and download it now
June 12th, 2012 9:08am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics