title: Having a problem populating a Dts Variable
body: <p>I have an SSIS package that is using a script task within a data flow task that should be populating a package level variable with a string value.  Stepping through the code shows that the variable is populating but once the script has finished, there is no value in the variable.  Any ideas?</p>
  
  <p>I've tried populating the variable via the Post Execute method.</p>
  
  <p>The variable is defined at package level:
  Name: bksbCreatedId
  Scope: CreateSingleAccount
  Data Type: String
  Value: </p>
  
  <p>The Script task has the variable specified in the ReadWrite Variables option:
  User::bksbCreatedId</p>
  
  <pre><code>public class ScriptMain : UserComponent
  {
      #region Help:  Using Integration Services variables and parameters
      #region Help:  Using Integration Services Connnection Managers
      #region Help:  Firing Integration Services Events
  
    private string _currentBKSBId;
  
      public override void PreExecute()
      {
          base.PreExecute();
  
          _currentBKSBId = "";
      }
  
      public override void PostExecute()
      {
          base.PostExecute();
  
          MessageBox.Show(string.Format("Current processing BKSB In Post Execute: {0}", _currentBKSBId)); // &lt;-- returns 64964081
          MessageBox.Show(string.Format("Current processing BKSB In Post Execute (Actual Variable - before populattion): {0}", Variables.bksbCreatedId)); // &lt;-- returns empty string
  
          Variables.bksbCreatedId = _currentBKSBId;
  
          MessageBox.Show(string.Format("Current processing BKSB In Post Execute (Actual Variable - after population): {0}", Variables.bksbCreatedId)); // &lt;-- returns 64964081
      }
  
      public override void Input0_ProcessInputRow(Input0Buffer Row)
      {
          _currentBKSBId = Row.bksbUserId.ToString();
  
          MessageBox.Show(string.Format("Current processing BKSB In Process Row: {0}", _currentBKSBId));  // &lt;-- returns 64964081
  
      }
  
  }
  </code></pre>
  
  <p>Prior to calling the script the value of Row.bksbUserId is "64964081".  This is what I expect the User::bksbCreatedId to be once the task has completed, so that the value can be used in another script task in a separate data control task.  However, when inspecting the variable on the Post-Excecute breakpoint of the script task, and the Pre-Execute breakpoint on the next Script task, the value is never populated and the variable remains empty.</p>
  
  <p>There are no errors occurring.</p>