Click here to Skip to main content
15,890,506 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
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.


C#
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));
    }
}

And i did so many research on google to try to figure it out but i get nothing
Posted
Updated 21-Sep-12 22:18pm
v3

1 solution

Hi ,
Check this
C#
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));

}


And Check this link also
http://support.microsoft.com/kb/919157[^]
Best Regards
M.Mitwalli
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900