01.
DataSet ds =
new
DataSet();
02.
DataTable dt =
null
;
03.
04.
var date1 = DateTime.Parse(TextBox1.Text);
05.
var date2 = DateTime.Parse(TextBox2.Text);
06.
07.
con.Open();
08.
cmd.Connection = con;
09.
cmd.CommandType = CommandType.Text;
10.
cmd.CommandText = @"SELECT Empid, Name, Lastname, Section, SUM(Getmoney) AS Expr1 FROM Cometowork WHERE Section =
'SALE'
and Date between @textbox1 and @textbox2
11.
group by Empid, Name, Lastname, Section order by Section";
12.
cmd.Parameters.Add(
"@textbox1"
, SqlDbType.DateTime).Value = date1;
13.
cmd.Parameters.Add(
"@textbox2"
, SqlDbType.DateTime).Value = date2;
14.
dtAdapter.SelectCommand = cmd;
15.
16.
dtAdapter.Fill(ds);
17.
dt = ds.Tables[0];
18.
19.
dtAdapter =
null
;
20.
con.Close();
21.
con =
null
;
22.
23.
ReportViewer1.LocalReport.DataSources.Clear();
24.
ReportViewer1.LocalReport.DataSources.Add(
new
ReportDataSource(
"DataSet1"
, dt));
25.
ReportViewer1.LocalReport.ReportPath =
"ReportHR.rdlc"
;
26.
ReportViewer1.LocalReport.Refresh();