title: Error with OracleDataReader. Error: Invalid operation. The connection is closed
body: <p>When I try to assign the reader C# throws an exception:</p>
  
  <p><code>Invalid operation. The connection is closed</code></p>
  
  <p>I try to get a result from a query that returns a single cell with an average value inside.
  cmd is an oraclecomand that i use to insert a row into a table and so far so good. I see the message box next and after that the exception appears.</p>
  
  <pre><code>          try
              {
                  cmd.ExecuteNonQuery();
                  MessageBox.Show("Recipe Rated");
                  OracleCommand cm = new OracleCommand("select round(avg(rating),1) from rates where id_rec = "+id);
                  OracleDataReader reader = cm.ExecuteReader();
                  reader.Read();
                  textBox5.Text =""+reader.GetInt16(0);
              }
  </code></pre>