title: SSIS Error - Object is not an ADODB.RecordSet or an ADODB.Record for only the failure sequence
body: <p>I have an SSIS project, having both a failure and success flows after a bunch of SQL Data Task is run, like:
  <a href="https://i.stack.imgur.com/tl8oX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tl8oX.png" alt="enter image description here"></a></p>
  
  <p>As you see, there are two different create email script tasks. Both script task includes those lines:</p>
  
  <pre><code> OleDbDataAdapter da = new System.Data.OleDb.OleDbDataAdapter();
   DataTable dt = new DataTable();
   da.Fill(dt, Dts.Variables["LogResultSet"].Value); //this line causing error
  </code></pre>
  
  <p>where LogResultSet is an object type of variable with the default value of "System.Object". Even though the lines above is working correctly for the Success Flow, it is giving an error like below when a failure happens.</p>
  
  <blockquote>
    <p>Object is not an ADODB.RecordSet or an ADODB.Record.</p>
  </blockquote>
  
  <p>The failure happening is a dummy failure in one of the stored procedures executed, like:</p>
  
  <pre><code>raiserror('Oh no a fatal error', 15, -1) 
  </code></pre>
  
  <p>When I tried to see the value of "Dts.Variables["LogResultSet"].Value" by using a MessageBox, I noticed that the value is <code>System._ComObject</code> for the success flow, but it is <code>System.Object</code> for the failure flow. So, for some reason the <code>LogResultSet</code> value is not changing when any error occurs and the sequence fails. I could not find why and how to fix it. </p>
  
  <p>I searched online, looked for solution in many platforms, including the link below, but nothing helped. Note that I tried all the offered solutions offered in the link below, no help..
  <a href="https://stackoverflow.com/questions/19776364/system-argumentexception-object-is-not-an-adodb-recordset-or-an-adodb-record">System.ArgumentException: Object is not an ADODB.RecordSet or an ADODB.Record</a></p>
  
  <p>Any advice or help would be appreciated. Thanks!</p>