title: OracleDataReader throws exception
body: <p>In my current applicaltion, I need to execute a SQL query, and get the count of the results returned before proceeding. This is my code below:</p>
  
  <pre><code>if (GetCount(reader) == 1)
                  {
                      reader.Read();
                      Console.WriteLine(reader["field1"]);
                      Console.WriteLine(reader["field2"]);
                  }
  </code></pre>
  
  <p>And this is the <code>GetCount()</code> method</p>
  
  <pre><code>public static int GetCount(OracleDataReader reader)
          {
              int count = 0;
  
              while (reader.Read())
              {
                  count++;
              }
  
              return count;
          }
  </code></pre>
  
  <p>After receiving the count of the results, when it enters the if code block, an exception gets thrown out stating:</p>
  
  <pre><code>[System.InvalidOperationException] = {"Operation is not valid due to the current state of the object."}
  </code></pre>
  
  <p>However, if I do not get the count, it works fine. </p>
  
  <p>I think that since my GetCount function has reader.Read(), I need to somehow reset the reader before reading the values? Honestly, I'm stumped. Any suggestions?</p>
  
  <p>Edit;
  In the first code block, I get the same exception even if I comment out <code>reader.Read();</code></p>