本文介绍了子报表"SubRepor"的数据检索失败,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是带有子报告的设计报告,并且总是收到此错误
I''m design Report with sub Report and I''m always get this Error
Data retrieval failed for the subreport, 'SubReportZone', located at: PassesInfo.Report.SubReportZone.rdlc. Please check the log files for more information.
private void Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'HeaderPerson.usp_ReportPersonByID' table. You can move, or remove it, as needed.
this.usp_ReportPersonByIDTableAdapter.Fill(this.HeaderPerson.usp_ReportPersonByID,1);
this.reportViewer1.RefreshReport();
this.reportViewer1.LocalReport.SubreportProcessing += new Microsoft.Reporting.WinForms.SubreportProcessingEventHandler(LocalReport_SubreportProcessing);
}
void LocalReport_SubreportProcessing(object sender, Microsoft.Reporting.WinForms.SubreportProcessingEventArgs e)
{
if (e.ReportPath == "DeatilReport")
{
int Per_ID = Convert.ToInt32(e.Parameters["Per_ID"].Values[0].ToString());
this.usp_GetPZonesTableAdapter1.Fill(detailPerson1.usp_GetPZones, Per_ID);
// when iam puting break point on datatable i saw the retrivaed data but in desgin it says Data retrieval failed for the subreport, 'SubReportZone', located at: PassesInfo.Report.SubReportZone.rdlc. Please check the log files for more information
e.DataSources.Add(new ReportDataSource(this.detailPerson1.usp_GetPZones.TableName, (DataTable)this.detailPerson1.usp_GetPZones));
}
}
而且我在Google上进行了很多研究,试图找出答案,但是我什么也没得到.
And i did so many research on google to try to figure it out but i get nothing
推荐答案
private void Form1_Load(object sender, EventArgs e)
{
this.usp_ReportPersonByIDTableAdapter.Fill(this.HeaderPerson.usp_ReportPersonByID,1);
//Place it First before Refresh
this.reportViewer1.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(SubreportProcessingEventHandler);
this.reportViewer1.RefreshReport();
}
void SubreportProcessingEventHandler(object sender, SubreportProcessingEventArgs e)
{
int Per_ID = Convert.ToInt32(e.Parameters["Per_ID"].Values[0].ToString());
this.usp_GetPZonesTableAdapter.Fill(DetailPerson.usp_GetPZones, Per_ID);
e.DataSources.Add(new ReportDataSource("DetailPerson", (DataTable)this.DetailPerson.usp_GetPZones));
}
并检查此链接也
http://support.microsoft.com/kb/919157 [ ^ ]
最好的问候
米特瓦里(M.Mitwalli)
And Check this link also
http://support.microsoft.com/kb/919157[^]
Best Regards
M.Mitwalli
这篇关于子报表"SubRepor"的数据检索失败,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!