I am showing 2 sub reports on a reports, one sub reports is showing fine but when i try to shown second report , it is showing below message
Error
Data retrieval failed for the subreport,
'Subreport2', located at: .
code:
string reportPath=e.ReportPath; SocialWorkDataset socialWorkDataset = new SocialWorkDataset(); if (reportPath == "GoalObjective") { // e.DataSources.Add(new ReportDataSource("SocialWorkISPSpiritualGoalObjectives", "DataSet1")); SocialWorkDatasetTableAdapters.SocialWorkISPSpiritualGoalObjectivesTableAdapter socialWorkISPSpiritualGoalObjectivesTableAdapter = new SocialWorkDatasetTableAdapters.SocialWorkISPSpiritualGoalObjectivesTableAdapter(); socialWorkISPSpiritualGoalObjectivesTableAdapter.ClearBeforeFill = true; socialWorkISPSpiritualGoalObjectivesTableAdapter.Fill(socialWorkDataset.SocialWorkISPSpiritualGoalObjectives); ReportDataSource reportDataSocialWorkISPSpiritualGoalObjective = new ReportDataSource(); reportDataSocialWorkISPSpiritualGoalObjective.Name = "DataSet1"; reportDataSocialWorkISPSpiritualGoalObjective.Value = socialWorkDataset.SocialWorkISPSpiritualGoalObjectives; //rptViewer.LocalReport.DataSources.Add(reportDataSocialWorkISPSpiritualGoal); //e.DataSources.Add(reportDataSocialWorkISPSpiritualGoalObjective); e.DataSources.Add(new ReportDataSource("DataSet1", (object)socialWorkDataset.SocialWorkISPSpiritualGoalObjectives)); } //Interventions if (reportPath == "GoalInterventions") { SocialWorkDatasetTableAdapters.SocialWorkISPSpiritualGoalIntervationsTableAdapter socialWorkISPSpiritualGoalInterventionTableAdapter = new SocialWorkDatasetTableAdapters.SocialWorkISPSpiritualGoalIntervationsTableAdapter(); socialWorkISPSpiritualGoalInterventionTableAdapter.ClearBeforeFill = true; socialWorkISPSpiritualGoalInterventionTableAdapter.Fill(socialWorkDataset.SocialWorkISPSpiritualGoalIntervations); ReportDataSource reportDataSocialWorkISPSpiritualGoalIntervention = new ReportDataSource(); reportDataSocialWorkISPSpiritualGoalIntervention.Name = "DataSetIntervation"; reportDataSocialWorkISPSpiritualGoalIntervention.Value = socialWorkDataset.SocialWorkISPSpiritualGoalIntervations; //rptViewer.LocalReport.DataSources.Add(reportDataSocialWorkISPSpiritualGoal); e.DataSources.Add(reportDataSocialWorkISPSpiritualGoalIntervention); //e.DataSources.Add(new ReportDataSource("DataSetIntervation", (object)socialWorkDataset.SocialWorkISPSpiritualGoalIntervations)); }
Please let me know what I am doing wrong.