Click here to Skip to main content
14,037,223 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
Data retrieval failed for the subreport, 'All_SpecificationRdlcSub', located at: 



when loading sub report

What I have tried:

Main Report Code


void LoadReport(int SampleDetails_Id)
    {        
        ReportViewer1.LocalReport.ReportPath = Server.MapPath("All_SpecificationRdlc.rdlc");
        ReportViewer1.LocalReport.EnableExternalImages = true;
        DataSet dsTata = new DataSet();


        DataTable DtChemicalGrading = new DataTable();
        DtChemicalGrading = CreateSampleTypeDt();
        Chemical_grade objChemical_grade = new Chemical_grade();

        DataTable dtChemicalType = objChemical_grade.GetReportData();
                
        ReportViewer1.LocalReport.DataSources.Clear();
        ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", dtChemicalType));

        ReportViewer1.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(SetSubDataSource);
        this.ReportViewer1.LocalReport.Refresh();

      

    }



Sub Report code


public void SetSubDataSource(object sender, SubreportProcessingEventArgs e)
    {

        int Chemical_Grade_Id = 0;
        int.TryParse(e.Parameters["Chemical_Grade_Id"].Values[0].ToString(), out Chemical_Grade_Id);
        DataTable dtGrading = new DataTable();
        Grading objGrading = new Grading();

        dtGrading = objGrading.GetSubReportData(Chemical_Grade_Id);



         e.DataSources.Add(new ReportDataSource("DataSet1", dtGrading));

}

I am getting data in subreport data table but when load it gives following Error.


Data retrieval failed for the subreport, 'All_SpecificationRdlcSub', located at: 
Posted
Comments
Richard Deeming 27-Nov-18 11:20am
   
Are you absolutely sure that the data source in the sub-report is called DataSet1?
ZurdoDev 28-Nov-18 15:31pm
   
Google has many suggestions. Spend some time troubleshooting.

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 | Cookies | Terms of Service
Web05 | 2.8.190424.1 | Last Updated 27 Nov 2018
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

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