title: Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteReader Missing Results
body: <p>I have a very simple method that utilizes Oracle.ManagedDataAccess to query datatables in Oracle.  The code is below.</p>
  
  <pre><code>private System.Data.DataTable ByQuery(Oracle.ManagedDataAccess.Client.OracleConnection connection, string query)
  {
      using(var cmd = new Oracle.ManagedDataAccess.Client.OracleCommand())
      {
          cmd.Connection = connection;
          cmd.CommandText = query;
          cmd.CommandType = System.Data.CommandType.Text;
          var dr = cmd.ExecuteReader();
          dr.Read();
          var dataTable = new System.Data.DataTable();
          dataTable.Load(dr);
          var recordCount = dataTable.Rows.Count;
          return dataTable;
      }
  }
  </code></pre>
  
  <p>Using a very simple query such as:</p>
  
  <pre><code>SELECT * FROM NKW.VR_ORDER_LI WHERE CTRL_NO = 10 
  </code></pre>
  
  <p>Returns 32 rows of data.  However when I run the exact same query from Oracle SQL Developer using the exact same user account I'm using in my connection string for the C# App, I get 33 results.</p>
  
  <p>I'm consistently missing a single row of data.</p>
  
  <p>I've tried querying a different CTRL_NO:</p>
  
  <pre><code>SELECT * FROM NKW.VR_ORDER_LI WHERE CTRL_NO = 17 
  </code></pre>
  
  <p>.Net returns 8 results.
  Oracle Sql Developer returns 9 results.</p>
  
  <p>I've tried removing the WHERE statement and just getting all results.</p>
  
  <p>Still 1 row difference between the two.</p>
  
  <p>I've tried googling for an answer but haven't been successful.  Any help or advice would be appreciated.</p>
  
  <p>UPDATE 1:</p>
  
  <p>I've determined that I'm always missing the first result that I see in Oracle SQL Developer when I run the exact same query from my C# App.</p>
  
  <p>UPDATE 2:</p>
  
  <p>As suggested I took the DataTable out of the equation.</p>
  
  <pre><code>int rowCount = 0;
  while(dr.Read())
  {
    rowCount++;
  }
  </code></pre>
  
  <p>rowCount skipping the DataTable still results in a missing record.</p>
  
  <p>UPDATE 3:</p>
  
  <p>Tested against a completely different table, NKW.VR_ORDER_LI is actually a view.  Still had the same results for some reason I end up with one less row of results from the ExecuteReader() than I do from within SQL Developer.</p>