无法为数据集'DataSet1'创建数据读取器

时间:2016-03-17 22:37:06

标签: c#

ReportViewer1.LocalReport.DataSources.Clear();
LocalReport rep = ReportViewer1.LocalReport;

ReportDataSource rds = new ReportDataSource();
rds.Name = "DataSet1";  //this is the name of the DataSet on your report rdlc

ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("dataset1", ObjectDataSource1));
rep.ReportPath = "Report1.rdlc";
DataSet ds = new DataSet();

1 个答案:

答案 0 :(得分:0)

            ReportViewer1.ProcessingMode = ProcessingMode.Local;
            LocalReport rep = ReportViewer1.LocalReport;
            rep.ReportPath = "Reports/YourReport.rdl";
            rep.DataSources.Clear();

            ReportDataSource rds1 = new ReportDataSource();
            rds1.Name = "DataSet1";
            rds1.Value = dt; // Your Pass in Dataset value (type : DataTable)
            rep.DataSources.Add(rds1);
            rep.Refresh();