我有一个主报表,它调用同一个子报表的两个实例,只有一个参数差异。主报表和子报表都可以在报表服务器上查看,并且存在于同一个文件夹中,使用同一个数据源,具有相同的权限。
报表在visual studio报表项目中查看时运行正常,但部署时不运行。
编辑:我发现问题出在具有 4 个或更多参数的子报告中。删除多值参数(降至 3)后,报告正确运行。向子报表添加非多值参数会导致问题再次出现。
我从 SQL Server 日志中收到以下错误:
processing!ReportServer_0-1!5884!11/20/2014-13:31:51:: e ERROR: An error has occurred while processing a sub-report. Details: Object reference not set to an instance of an object. Stack trace:
at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.IsAllDataShared(SubReport subReport, Boolean canShareDataSets)
at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.FetchSubReports(Report report, IChunkFactory getReportChunks, ErrorContext errorContext, OnDemandMetadata odpMetadata, CatalogItemContext parentReportContext, OnDemandSubReportCallback subReportCallback, Int32 subReportLevel, Boolean snapshotProcessing, Boolean processWithCachedData, Boolean canShareDataSets, GlobalIDOwnerCollection globalIDOwnerCollection, ParameterInfoCollection parentQueryParameters)
reportrendering!ReportServer_0-1!5884!11/20/2014-13:31:51:: e ERROR: Throwing Microsoft.ReportingServices.ReportProcessing.RenderingObjectModelException: The subreport 'rptCombinedItems' could not be found at the specified location /HVAC_STAGING/subrptQuoteLineItems. Please verify that the subreport has been published and that the name is correct., ;
Info: Microsoft.ReportingServices.ReportProcessing.RenderingObjectModelException: The subreport 'rptCombinedItems' could not be found at the specified location /HVAC_STAGING/subrptQuoteLineItems. Please verify that the subreport has been published and that the name is correct.
processing!ReportServer_0-1!5884!11/20/2014-13:31:51:: e ERROR: An error has occurred while processing a sub-report. Details: The subreport 'rptCombinedItems' could not be found at the specified location /HVAC_STAGING/subrptQuoteLineItems. Please verify that the subreport has been published and that the name is correct. Stack trace:
at Microsoft.ReportingServices.OnDemandReportRendering.SubReport.CheckRetrievalStatus(Status status)
at Microsoft.ReportingServices.OnDemandReportRendering.SubReport.RetrieveSubreport()
至于参数传递,主要报告使用
<Parameters>
<Parameter Name="OfficeCopy">
<Value>=Parameters!OfficeCopy.Value</Value>
</Parameter>
<Parameter Name="QuoteProfile">
<Value>=Parameters!QuoteProfile.Value</Value>
</Parameter>
<Parameter Name="isBreakout">
<Value>=NOT(Parameters!ShowTotal.Value)</Value>
</Parameter>
<Parameter Name="quoteIDs">
<Value>=Parameters!quoteIDs.Value</Value>
</Parameter>
<Parameter Name="printOptions">
<Value>=Parameters!printOptions.Value</Value>
</Parameter>
子报告需要:
<ReportParameters>
<ReportParameter Name="OfficeCopy">
<DataType>Boolean</DataType>
<Prompt>OfficeCopy</Prompt>
</ReportParameter>
<ReportParameter Name="QuoteProfile">
<DataType>Integer</DataType>
<Prompt>QuoteProfile</Prompt>
</ReportParameter>
<ReportParameter Name="isBreakout">
<DataType>Boolean</DataType>
<Prompt>isBreakout</Prompt>
</ReportParameter>
<ReportParameter Name="quoteIDs">
<DataType>Integer</DataType>
<Prompt>quoteIDs</Prompt>
<MultiValue>true</MultiValue>
</ReportParameter>
<ReportParameter Name="printOptions">
<DataType>Integer</DataType>
<Prompt>printOptions</Prompt>
<MultiValue>true</MultiValue>
</ReportParameter>
</ReportParameters>
最后,这是由 .NET 4.5.2 应用程序中的 Report Viewer 9.0.0.0 调用的,并且报表服务器正在运行 10.0.5520.0。服务器正在运行 Server 2008。