读书人

reportviewer报表一天未work out来的

发布时间: 2012-12-16 12:02:32 作者: rapoo

reportviewer报表高手请进,一天未work out来的问题

忙了一天的报表控件reportviewer,看了很多网上的方法,挨个测试了一遍,测试时网页均不显示数据。
下面是我最终的代码County_union_SectorTownTableAdapter是添加的数据集文件(.xsd)文件成的类,cus的GetData()得到的是表“County_union_SectorTown”的数据(这个做断点测试没有问题,能正常读取到记录)
ReportViewer1.LocalReport.ReportPath = Server.MapPath("Manage_city.aspx_report.rdlc");
County_union_SectorTownTableAdapter cus = new County_union_SectorTownTableAdapter();

Manage_city_report.County_union_SectorTownDataTable gvcr = cus.GetData(); ;

ReportDataSource rds = new ReportDataSource("County_union_SectionTown", gvcr);//这个引号的County_union_SectionTown是我随便起的名字,不知道跟这个又没有关系
this.ReportViewer1.LocalReport.DataSources.Add(rds);

ReportViewer1.DataBind();

ReportViewer1.LocalReport.Refresh();
[最优解释]
设置一下reportviewer的报表源为空
[其他解释]
建你用ODBC接,用存程形式做表,就不存在此。
[其他解释]
不能随便起名称,要数据集名_表名

读书人网 >.NET

热点推荐