放置子报表控件的地方总是报错: 位于 F:\项目\本地项目\Jiao.WebSite\Report\RdlcFiles\Warehouse\ExerciseSubReport_Dateil.rdlc 的子报表“ExerciseSubReport_Dateil”的数据检索失败。有关详细信息,请查看日志文件。
后台代码:
private DataTable dtDateil;
protected void btnQuery_Click(object sender, EventArgs e)
{
srViewer.LocalReport.ReportPath = Server.MapPath("/Report/RdlcFiles/Warehouse/ExerciseSubReport.rdlc");//调试table是有值的,前台那也显示了父报表的数据
DataTable table = Facade.Common.RDLC.ExerciseSubReport.GetExerciseSubReportData();
//调试dtDateil 是有值的,但是前台就报错
dtDateil = Facade.Common.RDLC.ExerciseSubReport.GetGetExerciseSubReportDateilData(); srViewer.LocalReport.SubreportProcessing +=
new SubreportProcessingEventHandler(SubreportProcessingEventHandler);
//ExerciseSubReport与父报表名是一样的
this.srViewer.LocalReport.DataSources.Add(new ReportDataSource("ExerciseSubReport", table));
this.srViewer.DataBind();
}/// <summary>
/// 为子报表加数据源
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void SubreportProcessingEventHandler(object sender, SubreportProcessingEventArgs e)
{
//ExerciseSubReport_Dateil与子报表名是一样的
e.DataSources.Add(new ReportDataSource("ExerciseSubReport_Dateil", dtDateil));
}
后台代码:
private DataTable dtDateil;
protected void btnQuery_Click(object sender, EventArgs e)
{
srViewer.LocalReport.ReportPath = Server.MapPath("/Report/RdlcFiles/Warehouse/ExerciseSubReport.rdlc");//调试table是有值的,前台那也显示了父报表的数据
DataTable table = Facade.Common.RDLC.ExerciseSubReport.GetExerciseSubReportData();
//调试dtDateil 是有值的,但是前台就报错
dtDateil = Facade.Common.RDLC.ExerciseSubReport.GetGetExerciseSubReportDateilData(); srViewer.LocalReport.SubreportProcessing +=
new SubreportProcessingEventHandler(SubreportProcessingEventHandler);
//ExerciseSubReport与父报表名是一样的
this.srViewer.LocalReport.DataSources.Add(new ReportDataSource("ExerciseSubReport", table));
this.srViewer.DataBind();
}/// <summary>
/// 为子报表加数据源
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void SubreportProcessingEventHandler(object sender, SubreportProcessingEventArgs e)
{
//ExerciseSubReport_Dateil与子报表名是一样的
e.DataSources.Add(new ReportDataSource("ExerciseSubReport_Dateil", dtDateil));
}
解决方案 »
- 关于回调的一点问题
- 遍历复选框为选中的状态!!!哪里错了帮我看看
- 解释代码根本意思
- [ 新手求教]想在文本框中自动显示系统时间,写了个代码不运行
- asp.net 中如何合并单元格?
- 如果确认选用的数据库不会更换,是否还有必要用三层?
- 服务器控件和客户端控件的区别
- 如何动态更换页面主题
- 【小的求教】为什么老有人说在asp.net中摒弃前台使用<%%>的方法
- 无法将类型为“ASP._Page_Views_Transport_Quarantine_cshtml”的对象强制转换为类型“System.Web.IHttpHa
- gridview中分页 统计信息总数问题??
- 過濾"-",javascript以及c#寫法
二、在主报表中拖了子报表控件然后右击子报表属性选择这个子报表指向哪个文件及传递给子报表的参数
三、在子报表中添加一个参数后台代码就是上面的,但是怎么总是报错呢?
参考