我正在尝试使用C#制作图形图表。但是我有这样的错误信息
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 ....
我已经尽力解决了这个问题,但是我没有找到纠正我的编码程序的方法。请问有人在这里可以帮助我纠正此问题吗? 谢谢。 这是我的代码
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);
}