日期:2014-05-16 浏览次数:20872 次
一:加数据集,并且命名为Quotation,如下图所示:

二: 添加一张报表,命名为Quotation,如下图所示:

向报表中添加“表”这一项,如下图所示:

这时就弹出一个选择数据源的对话框,如下图所示,自己选择要添加的数据源并命名:

将对应的datatable项添加到表中,如下图所示:

新建一个WINFORM表单
拖入reportView

绑定代码:
DataTable dt= JB_QuotationDAL.QuotationList(StrSql);
this.rptQuotation.LocalReport.EnableExternalImages = true;
this.rptQuotation.LocalReport.ReportPath = "Quotation.rdlc"; //查找要绑定的报表
this.rptQuotation.LocalReport.DataSources.Add(new ReportDataSource("dtQuotation", dt)); //绑定数据源
this.rptQuotation.RefreshReport();
效果:
