I try to send parameter to chart control. Parmeter source is defined by query string.
How can I send programmaticaly the parameter from query string to the SqlCommand and to
the Chart1.Series[0].Points.DataBindXY
when I debug I this exception is thrown:
Must declare the scalar variable "@Piezid"
Hi,
You can get the value from querystring on PageLoad and set it to SqlCommand such as this,
int PieceID=0;
int.TryParse(Request.QueryString["PieceID"],PieceID);
SqlCommand command = new SqlCommand(commandText, connection);
command.Parameters.Add("@ID", SqlDbType.Int);
command.Parameters["@ID"].Value = PieceID;
//Todo: Execute Command and fill datareader//
Chart1.Series["Series1"].Points.DataBind(
myReader, "Name", "Sales", "Tooltip=Year, Label=Commissions{C2}");
Refer to this to understand Data binding to chart control,
http://blogs.msdn.com/b/alexgor/archive/2009/02/21/data-binding-ms-chart-control.aspx
Please post your code for more help.
Hope this helps!
沒有留言:
張貼留言