Click here to Skip to main content
12,067,928 members (43,040 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# Microsoft Reporting
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));
    }
}
And i did so many research on google to try to figure it out but i get nothing
Posted 21-Sep-12 23:14pm
Dev-00011.6K
Edited 21-Sep-12 23:18pm
v3

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Hi ,
Check this
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
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160208.1 | Last Updated 22 Sep 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100