Hi all;
I am working on a web site with several reports, viewed in report viewer. We were getting all information back as single reports then we started using subreports to properly display the information. At first each report and subreport were getting their datasets from stored procedures. This started taking too long due to the separate db calls that had to take place for each of the three subreports for each row of the main query. (The users wanted each page of the main report to be one row from the main query with the resultsets for each of the three subqueries for that row displayed as well.) Then we got the idea to use a separate report dataset object that would load the entire results for each of the three subqueries into a dataset object, then just pull the data from those objects locally using LINQ for each row of the parent report like this.
private void LocalReport_SubreportProcessing(object sender, SubreportProcessingEventArgs args) { if (args.ReportPath == "subPRs") { int reqID = 0; if (int.TryParse(args.Parameters["ReqID"].Values.First(), out reqID)) { var prs = _PRdata.Where(w => w.ReqID == reqID); args.DataSources.Add(new ReportDataSource("DataSet1", prs)); } } }
This worked fine for the first two reports. However, on the third report, I suddenly started getting the error "A first chance exception of type 'Microsoft.ReportingServices.ReportProcessing.ReportProcessingException' occurred in Microsoft.ReportViewer.Common.dll"
followed by an error "A first chance exception of type 'Microsoft.ReportingServices.ReportProcessing.ReportProcessingException_FieldError' occurred in Microsoft.ReportViewer.Common.dll". I checked all of the field names and the properties of the object exactly
correspond with the field names on the subreport template.
In addition, I checked the data source information in the XML version of the rdlc. Again everything is correct. I tried putting everything back the way it was originally. And it still produced the same error. It is only this report. The data loads (eventually) fine. Everything is in there and in its correct field. However, it runs even more excruciatingly slowly than the three data calls per main report row.
Nothing I've tried seems to work and I have found nothing on the web that would be of help. Any assistance would be welcomed. Thanks in advance.