【发布时间】:2016-03-31 05:33:41
【问题描述】:
我在ReportViewer 中搜索关于Datatable 作为datasource 的最后一个问题,我发现这是解决方案
DataTable table = new DataTable();
table.Columns.Add("value", typeof(string));
table.Columns.Add("price", typeof(string));
table.Columns.Add("quantity", typeof(string));
table.Rows.Add("test1","10","20");
table.Rows.Add("test2", "10", "20");
reportViewer1.LocalReport.DataSources.Clear();
ReportDataSource rprtDTSource = new ReportDataSource("TITLE",table);
reportViewer1.LocalReport.DataSources.Add(rprtDTSource);
reportViewer1.RefreshReport();
但我得到这张图片作为结果
有什么问题??
【问题讨论】:
-
您在哪里设置报表查看器的报表?我想您有一个报告作为嵌入式资源,然后您可以将报告源设置为:
this.reportViewer1.LocalReport.ReportEmbeddedResource = "Namespace.ReportName.rdlc"; -
我只有数据表和报表查看器,如何在报表查看器@RezaAghaei 中显示数据
标签: c# winforms datatable reportviewer localreport