private void btnInquire_Click(object sender, EventArgs e)
{
string BeginDate = dtpBegin.Text.Trim();
string EndDate = dtpEnd.Text.Trim();
Facade.Facade faca = new Facade.Facade();
DataTable table = faca.InqCheckInfo(BeginDate, EndDate);
ReportDataSource rptDataSource = new ReportDataSource();
ReportParameter[] Params =
{
new ReportParameter("ID",Entity.Model.user),
new ReportParameter("CheckDate",DateTime.Now.ToShortDateString())
};
rptDataSource.Name = "DataSetCheckReport";//指定数据集名
rptDataSource.Value = table;//数据源名称
reportViewer.LocalReport.ReportEmbeddedResource = "UI.CheckReport.rdlc";//报表文件名
reportViewer.LocalReport.DataSources.Clear();//清空存在报表
reportViewer.LocalReport.DataSources.Add(rptDataSource);//添加数据源
reportViewer.LocalReport.SetParameters(Params);//传递参数
reportViewer.RefreshReport();//刷新报表控件
}
【代码】报表显示
最新推荐文章于 2024-06-07 10:43:59 发布