Last post Aug 03, 2017 02:54 PM by joeller
Aug 02, 2017 10:32 PM|joeller|LINK
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.
Aug 03, 2017 02:54 PM|joeller|LINK
I found the issue. I did not set the ReportDataset Object to have all of the fields of the stored procedure because I didn't need them. But in assigning the dataset object to the dataset in the report, it was still looking for these dataset fields in
the object even though they were not being used in the report.
Seems to me that was also the same issue even when I did not have the report rdlc datasource being set to the stored procedure, as I did not explicitly clear out those fields I was not using out of the XML.
So the error was being reported correctly. I am just an idiot.