title: C# Query MS-Access Table and place read values from column in a text box
body: <p>Below is a snapshot of my code.  I am trying to access the only column in the customer table and place the values into a textbox on the form.  I keep getting the error with my code <code>"InvalidOperationException was unhandled"</code> at the line declaring <code>dr</code> as a <code>OleDbDataReader</code> object.  </p>
  
  <ol>
  <li><p>What do I have wrong with the below code that would be giving me this error?</p></li>
  <li><p>Should I do a list to pick out the text I want from the database? </p></li>
  <li><p>How can I return the column values from access into a list in C# so that I can search the list for a particular value?</p>
  
  <pre><code>string strsql = "Select * from Customer";
  OleDbCommand cmd = new OleDbCommand();
  
  cmd.CommandText = strsql;
  conn.Open();
  
  OleDbDataReader dr = cmd.ExecuteReader();
  
  
  
  while(dr.Read())
  {
      textBox1.Text += dr["Customer"].ToString();
  }
  conn.Close();
  </code></pre></li>
  </ol>