【发布时间】:2014-02-18 16:10:10
【问题描述】:
我是 RDLC 报告的新手,我的要求很简单。 我设计了一个报告,并在该报告中设置了一些参数来填充动态数据。
现在我也需要动态显示表格。 所以我做了什么:
DataSet InvoiceSummaryDs = new DataSet();
DataTable table = new DataTable();
table.TableName = "summary";
table.Columns.Add( "name", typeof( string ) );
table.Rows.Add(Invoice.TotalBooking);
table.Rows.Add("£ " + Invoice.BillAmount);
table.Rows.Add("£ " + Invoice.BillAmount + " <br />" + "£ " + Invoice.VatAmount);
table.Rows.Add("£ " + Invoice.NetAmount);
InvoiceSummaryDs.Tables.Add(table);
ReportDataSource rptDataSource = new ReportDataSource("DSPrice", InvoiceSummaryDs.Tables[0]);
rv.LocalReport.DataSources.Add(rptDataSource);
rv.LocalReport.SetParameters(parms);
rv.LocalReport.Refresh();
所以服务器端代码没有问题,但报告中出现错误: 错误13 数据集“DS_NAME”引用了数据源“”,不存在。
错误 14 tablix ‘Tablix1’ 在报表正文中,但报表没有数据集。没有数据集的报表中不允许使用数据区域。
在 rdlc 文件中,我创建了一个没有源的同名“DSPrice”数据集,因为我想从服务器端而不是从这里动态填充数据。
这个例子我已经看过了:
http://www.gotreportviewer.com/ 动态生成 RDLC - 表
通过创建动态报表可以实现动态表绑定,但我不想创建动态报表。
任何人指导我什么是解决方案? 任何帮助将不胜感激。
【问题讨论】:
标签: c# asp.net-mvc rdlc