I have a asp.net page in which I have a chart that I dragged on from the toolbox designer. I know that if I click on this chart, a "chart tasks" menu will appear so that I can define the sql data source, chart type and x&y values. The problem I am having is that my sql data source requires user input. I want the user to input a date and search records based on the input date. Therefore, I cant define an sql query on the chart tasks menu because it will tell me that my query is invalid. My code looks like this so far:
con1.Open();
SqlCommand cmd2 = new SqlCommand (string.Format ("select CustomerName, AccountNumber, DateReading, Time, ID from dbo.NewLogTable join dbo.CustomerTable on ID = Customer_ID join dbo.VoltageTable on Voltage_Reading = Provided_Voltage where Sensor_ID = 'FA0009' and DateReading= '{0}' " ,TextBox1.Text), con1);
SqlDataAdapter da2 = new SqlDataAdapter(cmd2);
DataSet ds2 = new DataSet();
da2.Fill(ds2);
Chart2.DataSource = da2;
Chart2.Visible = true;
Chart2.DataBind();
con1.Close();
whenever I input the date and click the button, nothing happens. I know the sqlCommand is correct. However, I can not find a way to set the x and y values for my chart. I tried Chart2.Xvalue and .parameters and cant find a way to set those. I think that is whats giving me trouble. Can anyone shed some light on this issue? Thanks.