01.
public
void
chooseReceive(DateTime str1, DateTime str2)
///// Field วันที่เริ่มต้น และ วันที่สิ้นสุด
02.
{
03.
ReportDocument rDoc =
new
ReportDocument();
04.
05.
rDoc.Load(
"C:/..ABC/RptReceive.rpt"
);
06.
07.
rDoc.SetDatabaseLogon(
""
,
""
,
".\\SQLEXPRESS"
,
"Database name"
);
08.
rDoc.VerifyDatabase();
09.
rDoc.SetParameterValue(
"para3"
, str1);
10.
rDoc.SetParameterValue(
"para4"
, str2);
11.
12.
rDoc.RecordSelectionFormula =
"{Receive.Date_rc}in DateTime('"
+ str1 +
"')to DateTime('"
+ str2 +
"')"
;
13.
14.
crystalReportViewer1.ReportSource = rDoc;
15.
crystalReportViewer1.Refresh();
16.
}