我的RDLC包含两个数据集:DataSetObracun和DataSet1。我试图以这种方式以编程方式加载报告:
this.obracunTableAdapter.FillObracun(this.putniDataSet1.obracun, brojTure, dodatnaOznaka, Convert.ToInt16(godinaTure));
this.tbltureTableAdapter1.FillTuraInfo(this.dsTura1.tblture, brojTure, dodatnaOznaka, godinaTure);
this.reportViewer1.LocalReport.ReportEmbeddedResource =
"Project.Putni.RPT.rptObracun2.rdlc"; ReportDataSource rptds = new
ReportDataSource(); rptds.Name = "DataSetObracun"; rptds.Value =
putniDataSet1.Tables[0];
this.reportViewer1.LocalReport.DataSources.Add(rptds);
this.reportViewer1.RefreshReport(); this.reportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout);
当我运行报告时,我收到错误:
本地报告处理期间发生错误。发生了错误 在报告处理期间。无法为数据集创建数据读取器 '数据集1';
问题是如何通过代码定义此行上有两个数据集:
rptds.Name = "DataSetObracun";
rptds.Value = putniDataSet1.Tables[0];