RDLC - 报告未显示仅数据标题显示

时间:2013-10-05 11:34:03

标签: c# asp.net rdlc

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

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

1 个答案:

答案 0 :(得分:0)

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

   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]是您从查询中获取的数据集。