title: SSIS - Object variable converted to DataTable becomes empty
body: <p>I'm trying to create an object variable that will hold a collection from an <strong><em>Execute SQL Task</em></strong>. This collection will be used in multiple <strong><em>Script Task</em></strong> throughout the ETL package.</p>
  
  <p>The problem is, after the first <code>Fill</code> of the first <strong><em>Script Task</em></strong>, the object variable becomes empty. Here's a code on how I used the variable to a DataTable:</p>
  
  <pre><code>try
              {
                  DataTable dt = new DataTable();
  
                  OleDbDataAdapter da = new OleDbDataAdapter();
  
                  da.Fill(dt, Dts.Variables["reportMetrics"].Value);
  
                  Dts.TaskResult = (int)ScriptResults.Success;
              }
              catch (Exception Ex)
              {
                  MessageBox.Show(Ex.Message);
                  Dts.TaskResult = (int)ScriptResults.Failure;
              }
  </code></pre>
  
  <p>Throughout the ETL package, <strong><em>Script Task</em></strong> components will have this piece of code. Since the variable becomes empty after the first <code>Fill</code>, I can't reuse the object variable.</p>
  
  <p>I'm guessing that the Fill method has something to do with this.</p>
  
  <p>Thanks!</p>