Click here to Skip to main content
15,887,585 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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.
Member 13541763 10-May-20 8:07am    
i am facing the same problem and almost i've coded the same, can you please give us hint about how you solved it? i know it's late but may this can help me.

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