RDLC - 报表不显示仅显示数据标题

本文关键字:显示 标题 数据 报表 RDLC | 更新日期: 2023-09-27 18:34:12

请帮助我,我需要你的一些时间.这是我的代码下面,它只显示标题而不是行数据。但是数据来自这个数据库,请看一下。谢谢

 FineDataSet.CountryDataTable fc = new FineDataSet.CountryDataTable();
 FineDataSetTableAdapters.CountryTableAdapter fsad = new FineDataSetTableAdapters.CountryTableAdapter();
 fsad.Fill(fc);
 //ReportDataSource rds = new ReportDataSource("DataSet12_SubCityGrandTotal", fsw.TableName);
 //rds.DataSourceId = fs;
 ReportViewer1.LocalReport.EnableExternalImages = true;
 ReportViewer1.ProcessingMode = ProcessingMode.Local;
 ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Reports/Myreport2.rdlc");
 ReportViewer1.Visible = true;
 Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource();
 rds.Name = "DataSet1";
 rds.Value =  fc.TableName;
 ReportViewer1.LocalReport.DataSources.Clear();
 ReportViewer1.LocalReport.DataSources.Add(rds);
 //ReportViewer1.ServerReport.Refresh();
 ReportViewer1.LocalReport.Refresh();
 ReportViewer1.DataBind();
 GridView1.DataSource = fc;
 GridView1.DataBind();

RDLC - 报表不显示仅显示数据标题

如果有人来这里——这就是您必须将数据从数据库设置为报告的方式 -

   viewer.LocalReport.DataSources.Add(new ReportDataSource("dataset_name_as_in_rdlc_file", dataset.Tables[0]));

此处的名称"dataset_name_as_in_rdlc_file"应与您使用的 rdlc 文件中的名称相同。表[0] 是你从查询中获取的数据集。