【问题标题】:RDLC - Report not showing Data only headings ShowingRDLC - 报告未显示仅数据标题显示
【发布时间】:2015-12-15 18:32:04
【问题描述】:

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

 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();

【问题讨论】:

    标签: c# asp.net rdlc


    【解决方案1】:

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

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

    此处的名称“dataset_name_as_in_rdlc_file”应与您使用的 rdlc 文件中的名称相同。dataset.Tables[0] 是您从查询中获得的数据集。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-08-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-10-16
      • 2018-11-13
      相关资源
      最近更新 更多