enter image description here我可以使用不带参数的存储过程在C#Winforms中填充图表控件,这很好。但是现在我需要使用带参数的存储过程。任何建议如何做到这一点?C#图表控件使用带参数的存储过程进行填充
以下是我的代码,我如何使用不带参数的存储过程填充图表控件。
sqlCon.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = sqlCon;
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter myCommand = new SqlDataAdapter("[Proc1]", sqlCon);
DataSet ds = new DataSet();
myCommand.Fill(ds);
DataView source = new DataView(ds.Tables[0]);
chart1.DataSource = source;
chart1.ChartAreas["ChartArea1"].AxisX.Interval = 1;
chart1.Series[0].XValueMember = "Pojazd";
chart1.Series[0].YValueMembers = "Suma";
chart1.DataBind();
请帮我:-)
它类似于通过参数化查询,如'cmd.Parameters.Add()' –
我tryed,但没有奏效。 – MROCZEK
我不确定DataSet在这种情况下是否是正确的对象... – MROCZEK