我相信我的代码很好,但是当我开始执行该程序时,我的图表没有显示任何内容,黑色的图表在Windows窗体中弹出,也没有错误。我的代码试图做的是每天获取日期和患者人数。但是当我再次执行系统时,即使边距消失了,我的图表还是什么也没显示
string strConn = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Toshiii\Documents\Pasyente.accdb;
Persist Security Info=False;";
OleDbConnection conn = new OleDbConnection(strConn);
try
{
conn.Open();
string strSQL = "Select count(PatientID) AS TOTAL, DateofC from
Patient GROUP BY DateofC";
OleDbCommand cmd = new OleDbCommand(strSQL, conn);
OleDbDataReader dtr = cmd.ExecuteReader();
while (dtr.Read())
{
chart1.Series["Point"].XValueMember = "TOTAL";
chart1.Series["Point"].YValueMembers = "DateofC";
}
dtr.Close();
conn.Close();
}
catch (Exception ex)
{
MessageBox.Show("" + ex);
conn.Close();
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}