PDF Export issue in Reporting Services
在 Reporting Services 2008 中将报表导出为 PDF 时遇到错误。
错误信息是;
Object reference not set to an
instance of an object. Description:
An unhandled exception occurred during
the execution of the current web
request. Please review the stack trace
for more information about the error
and where it originated in the code.Exception Details: System.Exception:
Object reference not set to an
instance of an object.Source Error:
An unhandled exception was generated
during the execution of the current
web request. Information regarding the
origin and location of the exception
can be identified using the exception
stack trace below.Stack Trace:
[Exception: Object reference not set
to an instance of an object.][Exception: An error occurred during
rendering of the report.][Exception: An error occurred during
rendering of the report.]
Microsoft.Reporting.WebForms.ServerReport.ServerUrlRequest(Boolean
isAbortable, String url, Stream
outputStream, String& mimeType,
String& fileNameExtension) +520
Microsoft.Reporting.WebForms.ServerReport.InternalRender(Boolean
isAbortable, String format, String
deviceInfo, NameValueCollection
urlAccessParameters, Stream
reportStream, String& mimeType,
String& fileNameExtension) +963
Microsoft.Reporting.WebForms.ServerReport.Render(String
format, String deviceInfo,
NameValueCollection
urlAccessParameters, Stream
reportStream, String& mimeType,
String& fileNameExtension) +28
Microsoft.Reporting.WebForms.ServerModeSession.RenderReport(String
format, Boolean
allowInternalRenderers, String
deviceInfo, NameValueCollection
additionalParams, Boolean
cacheSecondaryStreamsForHtml, String&
mimeType, String& fileExtension) +85
Microsoft.Reporting.WebForms.ExportOperation.PerformOperation(NameValueCollection
urlQuery, HttpResponse response) +150
Microsoft.Reporting.WebForms.HttpHandler.ProcessRequest(HttpContext
context) +183
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+181 System.Web.HttpApplication.ExecuteStep(IExecutionStep
step, Boolean& completedSynchronously)
+75
但是,此错误并不总是出现在此报告中,它仅发生过几次,具体取决于我们在报告参数中使用的日期。我是 Reporting Services 的新手,任何人都可以帮我找出可能导致问题的原因吗?
隐藏行逻辑会导致此错误。隐藏行逻辑引用了未分配给表的数据集中的值。当我删除该隐藏逻辑时,它可以正常导出。为了解决这个问题,我只是以不同的方式编写了隐藏逻辑,以仅使用表数据集中的值。
我已经弄清楚是什么原因造成的(就我而言)。之所以发生这种情况,是因为我的报告网格中的一个字段包含逗号和空格。这些字符中的每一个都会引发可怕的 \\'object reference...\\' 异常。我在存储过程中使用了一个 REPLACE 函数,该函数驱动报告用竖线字符替换逗号和空格。这不是一个非常优雅的解决方案,所以我很想听听其他人是否有关于这个问题的想法。