title: Graphic Chart In C#
body: <p>I am trying to make Graphic Chart in C#. But I have got an error info like this</p>
  
  <blockquote>
  <pre><code>Error System.InvalidOperationException: Operation is not valid du to the current state of the object.
  at Oracle.DataAccess.Client.OracleCommand.ExecuteReader(Boolean requery, Boolean fillRequest, CommandBehavior behavior)
  at Oracle.DataAcess.Client.OracleCommand.ExecuteReader()
  at WindowsFormsApplication1.Form3.btnLOAD_Click(Object sender, EventArgs e) in ....
  </code></pre>
  </blockquote>
  
  <p>I have tried harder to solve this problem, but I did not find the way to rectify my coding program. Does anyone here could help me to rectify this problem please?
  Thank you.
  Here's my code</p>
  
  <pre><code>try
          {
              con.Open();
              OracleCommand command = new OracleCommand();
              command.Connection = connection;
              string query = "SELECT * FROM TMCI_QC_LINE";
              command.CommandText = query;
  
              OracleDataReader dr = command.ExecuteReader();
              while (dr.Read())
              {
                  chart1.Series["QTY_NG"].Points.AddXY(Convert.ToInt32(dr["ITM_CD"].ToString()), Convert.ToInt32(dr["QTY_NG"].ToString()));
              }
              con.Close();
          }
          catch (Exception ex)
          {
              MessageBox.Show("Error " + ex);
          }
  </code></pre>