private void GraphToprej() { SqlConnection con = new SqlConnection(cs); SqlCommand cmd = new SqlCommand("Toprej", con); cmd.Parameters.AddWithValue("@fromDate", dtfrom.Value); cmd.Parameters.AddWithValue("@toDate", dtto.Value); cmd.CommandType = CommandType.StoredProcedure; con.Open(); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { Rejcategory.Add(dr.GetString(0)); RejSum.Add(dr.GetInt32(1)); } ChartTopRej.Series[0].Points.DataBindXY(Rejcategory, RejSum); dr.Close(); con.Close(); } private void datefil_Click(object sender, EventArgs e) { GraphToprej(); }
create proc toprej @fromDate date, @toDate date as select top 10 RejectReason1 as Reason, Sum(NetWt) as Quantity from IP_Spools Where status = 'Reject' AND DOE between @fromDate and @toDate group by RejectReason1 order by Sum(NetWt) desc g
Rejcategory
RejSum
private void GraphToprej() { Rejcategory.Clear(); RejSum.Clear(); ...
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)