title: Oracle InvalidOperationException - When trying to select from a table
body: <p>I've got a parameters table where I've got a parameter to say whether my program should run, I'm trying to get this value to check for a function.</p>
  
  <p>Here is the function</p>
  
  <pre><code>    private static bool shouldRun()
      {
          OracleCommand c = conn.CreateCommand();
  
          c.CommandText = "select value from parameters where lower(name) = lower('valuetocheck')"; // this one doesn't work
          //c.CommandText = "select 'Y' from dual"; - This one works
          c.CommandType = System.Data.CommandType.Text;
  
          OracleDataReader dr = c.ExecuteReader();
  
          dr.Read();
  
          string s = dr.GetString(0); // exception on this line
  
          return false;
      }
  </code></pre>
  
  <p>The additional information is below:</p>
  
  <blockquote>
    <p>Invalid operation on a closed object</p>
  </blockquote>
  
  <p>I've tried selecting from dual, as you can see above, which works perfectly fine, but when I try to run the actual query it doesn't like it. I've checked the query in SQL Developer and it works fine.</p>
  
  <p>I've had a look around SO and other websites and the only information I could get on this issue was that the command wasn't associated with a connection, which as you can see above it is.</p>
  
  <p>I've also tried just doing </p>
  
  <pre><code>OracleCommand c;
  c.Connection = conn;
  </code></pre>
  
  <p>Which also doesn't work.</p>
  
  <p>Any insight into this would be great, thanks!</p>