title: There is already an open DataReader associated with this Command which must be closed first
body: <p>I've got a question. Could you tell me what could be wrong in this code? So case looks like this: program shows me this error but not every time.Sometimes it does show it some times it doesn't.</p>
  <p>Error:</p>
  <blockquote>
  <p>An unhandled exception of type 'System.InvalidOperationException' occurred in System.Data.dll</p>
  <p>Additional information: There is already an open DataReader associated with this Command which must be closed first.</p>
  </blockquote>
  <p>Code:</p>
  <pre><code> private void loadlist() 
      {
          ItemList.Items.Clear();
          NumberList.Items.Clear();
  
          newConnection.connection();
          cmd.CommandText = &quot;select * from Items&quot;;
          dr = cmd.ExecuteReader();
          
          if (dr.HasRows)
          {
              while (dr.Read())
              {
                  ItemList.Items.Add(dr[0].ToString());
                  NumberList.Items.Add(dr[1].ToString());
              }
          }
          dr.Close();
          newConnection.cnOff();
          
      }
  </code></pre>
  <p>I can delete &quot;dr.Close()&quot; and it worked and after i try run and i must edit some code(write back &quot;dr.Close()&quot; ) and it worked back. Btw. sorry for my english :&lt;</p>