C# 在c中找不到SoapException错误代码#

C# 在c中找不到SoapException错误代码#,c#,exception,reporting-services,soapexception,C#,Exception,Reporting Services,Soapexception,我试图捕获特定的SOAPException,但找不到要使用的错误代码 我已经尝试使用获取错误代码 catch(SoapException e) { // Get error code int ErrorCode = System.Runtime.InteropServices.Marshal.GetExceptionCode(); //System.Runtime.InteropServices.Marshal.GetHRForE

我试图捕获特定的SOAPException,但找不到要使用的错误代码

我已经尝试使用获取错误代码

 catch(SoapException e)
        {
            // Get error code
            int ErrorCode = System.Runtime.InteropServices.Marshal.GetExceptionCode(); //System.Runtime.InteropServices.Marshal.GetHRForException(e);

            switch (ErrorCode)
            {
                case -2146233087:
                    {
                        // Default parameters have not been established in the report
                        return "false";
                    }
                default:
                    {
                        return "false";
                    }
            }
        }
但这是行不通的。有人知道在哪里查找错误代码吗? 我能想到的唯一解决办法就是在屏幕上进行字符串匹配

e.GetBaseException().ToString()
但那将是丑陋的

回答

string ErrorCode = ((e.Detail).FirstChild).InnerText; 

返回“rsAccessDenied”,这是我评估错误所需的信息。

您应该输入该信息作为答案,并将其标记为已接受,以便其他人将来可以找到它
string ErrorCode = ((e.Detail).FirstChild).InnerText;