我试图在水晶报表中输入与其编辑掩码不匹配的参数值。它会引发Report Application服务器失败错误。无论如何都要捕获此异常并抛出用户可理解的异常。问题是堆栈跟踪没有显示我的代码的任何部分。通过我的代码写入.net的方式
System.Runtime.InteropServices.COMException: The Report Application Server failed at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.GetParamPromptingInfo(PromptingRequestInfo promptingRequestInfo, Object& promptingUnits, Object& promptingInfoProvider) : Line 0 at CrystalDecisions.ReportSource.EromReportSourceBase.DoParameterPrompting(PromptingRequestContext reqContext) : Line 0 at CrystalDecisions.Web.ReportAgent+ReportClosedExceptionHandlingReportSource.DoParameterPrompting(PromptingRequestContext reqContext) : Line 0 at CrystalDecisions.Web.ReportAgentBase.DoPrompting(PromptingHTMLRenderOption htmlOption) : Line 0 at CrystalDecisions.Web.Components.ParamComponent.ShowFullPrompt() : Line 0 at CrystalDecisions.Web.Components.ParamComponentBase.HandleException(Exception e) : Line 0 at CrystalDecisions.Web.CrystalReportViewer.HandleExceptionAndPromptIfNeeded(Exception x, EnumAspNetLifeCycleStage stage) : Line 0 at CrystalDecisions.Web.CrystalReportViewer.OnPreRender(EventArgs e) : Line 0 at System.Web.UI.Control.PreRenderRecursiveInternal() : Line 0 at System.Web.UI.Control.PreRenderRecursiveInternal() : Line 0 at System.Web.UI.Control.PreRenderRecursiveInternal() : Line 0 at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) : Line 0
答案 0 :(得分:0)
Asp.net ReportViewer有ReportError
个事件,您可以处理并自定义错误OnReportError="ReportViewer1_OnReportError"
检查CrystalReportViewer是否有类似内容:
CrystalReportViewer.onHandleException or
CrystalReportViewer.OnHandleExceptionAndPromptIfNeeded
HandleException() Fired when an exception occurs.
参考:http://www.crystalreportsbook.com/Crystal_Reports_Net_Ch14_3.asp 不容易找到新的文件。