我有一个主报表,它调用同一子报表的两个实例,只有一个参数差异。主报表和子报表都可以在报表服务器上查看,并存在于同一文件夹中,并使用相同的数据源并具有相同的权限。
在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。