title: SSIS display variable values in script task
body: <p>I'm doing some testing, outputting a full result set from a Execute SQL Task into a Foreach loop as below</p>
  
  <p><img src="https://i.stack.imgur.com/uNo4h.png" alt="enter image description here"></p>
  
  <p>and I just want to output my variable values to a message box, however it doesn't seem to work.</p>
  
  <pre><code>public void Main()
      {
  
          try
          {
  
              // TODO: Add your code here
              string Variables = Dts.Variables["User::ClientID"].ToString() +
              Dts.Variables["User::Passphrase"].ToString() +
              Dts.Variables["User::KeyFileName"].ToString() +
              Dts.Variables["User::InboundEncryptionRequired"].ToString() +
              Dts.Variables["User::SftpResponseRequired"].ToString() +
              Dts.Variables["User::OutboundDecryptionRequired"].ToString() +
              Dts.Variables["User::SftpHost"].ToString() +
              Dts.Variables["User::SftpPort"].ToString() +
              Dts.Variables["User::SftpUserName"].ToString() +
              Dts.Variables["User::Active"].ToString() +
              Dts.Variables["User::SftpDownloadFrom"].ToString() +
              Dts.Variables["User::SftpUploadTo"].ToString() +
              Dts.Variables["User::SftpDeleteFilesFromRemote"].ToString() +
              Dts.Variables["User::ConnectionProtocol"].ToString();
  
              MessageBox.Show(Variables);
  
          }
  
  
  
          catch (Exception Ex)
          {
  
              MessageBox.Show(Ex.Message);
  
          }
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I'm just getting "element cannot be found in a collection" or something, even though I know the query is outputting 2 rows.</p>
  
  <p>I have also mapped my variables on the foreach loop and specified read only variables on scrip task.</p>
  
  <p><strong>* UPDATE *</strong></p>
  
  <p>This is driving me nuts.  I've triple checked my variable names, can confirm I'm getting full result set.</p>
  
  <p><img src="https://i.stack.imgur.com/GPyO5.png" alt="enter image description here"></p>
  
  <p>I removed the User:: from my script task variables, but still no luck.</p>