From: tfs@dslextreme.com   
      
   I find that I can access the ReadOnlyVariable fine in a Script Task in the   
   Control Flow but cannot access ReadOnlyVariables from a Script Component in   
   the Data Flow.   
      
   I also cannot put breakpoints in the Script Component. But it works fine in   
   the script task.   
      
   Tom   
      
   "tshad" wrote in message   
   news:K0p%o.1492$gx6.575@newsfe22.iad...   
   >I found that this error happens only when I put a variable in the   
   >ReadOnlyVariable property. If I put the variable into the ReadWrite   
   >Variable I don't get that error. Not sure why this is as I am not writing   
   >to the variable.   
   >   
   > I did find that I can't use the variable in my script actually. When it   
   > runs and gets to the point where I accessed the variable I get the error:   
   >   
   > The collection of variables locked for read and write access is not   
   > available outside of PostExecute.   
   >   
   > Actually, I seem to be able to use it in PreExecute as well but not in the   
   > CreateNewOutputRows method.   
   >   
   > I am setting a variable in the PostExecute and PreExecute methods but it   
   > doesn't seem to do anything and leaves the original value that I initially   
   > set it to.   
   >   
   > My code looks like:   
   >   
   > *********************************   
   > using System;   
   > using System.Data;   
   > using Microsoft.SqlServer.Dts.Pipeline.Wrapper;   
   > using Microsoft.SqlServer.Dts.Runtime.Wrapper;   
   >   
   > [Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]   
   > public class ScriptMain : UserComponent   
   > {   
   > string myIntegerVariableValue = "201123"; //Set it here   
   >   
   > public override void PreExecute()   
   > {   
   > base.PreExecute();   
   > }   
   > public override void PostExecute()   
   > {   
   > base.PostExecute();   
   > myIntegerVariableValue = Convert.ToString(Variables.RowCnt);   
   > //Set here   
   > }   
   > public override void Input0_ProcessInputRow(Input0Buffer Row)   
   > {   
   > myIntegerVariableValue = Convert.ToString(Variables.RowCnt);   
   > //Set it here   
   > }   
   > public override void CreateNewOutputRows()   
   > {   
   > Output0Buffer.AddRow();   
   > myIntegerVariableValue = Convert.ToString(Variables.RowCnt); //   
   > Causes error here   
   >   
   > // if left out it works fine but returns 201123   
   > Output0Buffer.Resultstext = "This is a test with row count = " +   
   > myIntegerVariableValue;   
   > }   
   > }   
   > ***********************************   
   >   
   > So how do I get the value from this variable????   
   >   
   > Thanks,   
   >   
   > Tom   
   > "tshad" wrote in message   
   > news:MCm%o.1307$zw7.413@newsfe12.iad...   
   >> Not really.   
   >>   
   >> In my example, the script works as long as I don't include a   
   >> ReadOnlyVariable in the Scripts Property section. If I add one in then I   
   >> get the error without changing anything else.   
   >>   
   >> And it is not like I misspelled or something because I am picking it out   
   >> of a list.   
   >>   
   >> The console may have a message that means something but it closes right   
   >> away.   
   >>   
   >> Also, the file is created to it obviously got past the script to the Flat   
   >> File Destination since that file is created and that is where it is   
   >> referenced.   
   >>   
   >> Thanks,   
   >>   
   >> Tom   
   >>   
   >> "Bob Barrows" wrote in message   
   >> news:ihkpb0$fuc$1@news.eternal-september.org...   
   >>> tshad wrote:   
   >>>> In 2008, I have a package that works fine where I am getting rows   
   >>>> from my sql query and then I pass that to a Derived Column   
   >>>> Transformation which goes to a Script Task that just write a piece of   
   >>>> text and that goes to a Flat File Destination.   
   >>>>   
   >>>> In the Script task, I have the following:   
   >>>>   
   >>>> public override void CreateNewOutputRows()   
   >>>> {   
   >>>> /*   
   >>>> Add rows by calling the AddRow method on the member   
   >>>> variable named "
|