我正在努力使用SqlDataReader和ChartControl。我已经添加了一行没有任何问题,但我想添加其中的多个,并且根本不能这样做我一整天都在寻找它。
我所拥有的是具有列id,date,value1,value2,value3的一些名称的表。我正在使用SqlDataReader获取它们。
SqlConnection con4 = new
SqlConnection(ConfigurationManager.ConnectionStrings["przychodniaConnectionString1"].ConnectionString);
string cmdStr4 = "select badCisData, badCisSkurczowe, badCisRozkurczowe, badCisPuls from badanieCis where pacID='" +
Label3.Text + "' ORDER BY badCisData ASC";
SqlCommand getResults = new SqlCommand(cmdStr4, con4);
con4.Open();
SqlDataReader reader = getResults.ExecuteReader();
然后我正在制作我的图表:
Chart2.Series [“Series1”]。Points.DataBindXY(reader,“badCisData”, 读者,“badCisPuls”); Chart2.Series [“Series2”]。Points.DataBindXY(reader,“badCisData”, 读者,“badCisSkurczowe”);
我在Series2上有错误。我想把日期放在x轴和y轴上(value1,value2等)
答案 0 :(得分:0)
using (SqlConnection con4 = new
SqlConnection(ConfigurationManager.ConnectionStrings["przychodniaConnectionString1"].ConnectionString))
{
string cmdStr4 = "select badCisData, badCisSkurczowe, badCisRozkurczowe, badCisPuls from badanieCis where pacID='" +
Label3.Text + "' ORDER BY badCisData ASC";
using (SqlCommand getResults = new SqlCommand(cmdStr4, con4))
{
con4.Open();
using (SqlDataReader reader = getResults.ExecuteReader())
{
if (reader.Read())
{
//Your code like reader["Column Name"]
}
}
}
}