次の方法で共有


Detail プロパティを使用したエラー処理

例外を細かく分類するために、Reporting Services によって、SOAP 例外の Detail プロパティの子要素の InnerText プロパティにある追加のエラー情報が返されます。Detail プロパティは XmlNode オブジェクトであるため、次のコードを使用して Message 子要素の内部テキストにアクセスできます。

Detail プロパティに含まれる有効なすべての子要素の一覧については、「Detail プロパティ」を参照してください。詳細については、Microsoft .NET Framework SDK ドキュメントの「Detail プロパティ」を参照してください。

Try
' Code for accessing the report server
Catch ex As SoapException
   ' The exception is a SOAP exception, so use
   ' the Detail property's Message element.
   Console.WriteLine(ex.Detail("Message").InnerXml)
End Try
try
{
   // Code for accessing the report server
}
catch (SoapException ex)
{
   // The exception is a SOAP exception, so use
   // the Detail property's Message element.
   Console.WriteLine(ex.Detail["Message"].InnerXml);
}
Try
' Code for accessing the report server
Catch ex As SoapException
   If ex.Detail("ErrorCode").InnerXml = "rsInvalidItemName" Then
   End If ' Perform an action based on the specific error code
End Try
try
{
   // Code for accessing the report server
}
catch (SoapException ex)
{
   if (ex.Detail["ErrorCode"].InnerXml == "rsInvalidItemName")
   {
      // Perform an action based on the specific error code
   }
}

次のコード行によって、SOAP 例外で返される特定のエラー コードがコンソールに書き込まれます。また、エラー コードを評価して特定のアクションを実行することもできます。

Console.WriteLine(ex.Detail("ErrorCode").InnerXml)
Console.WriteLine(ex.Detail["ErrorCode"].InnerXml);

参照

関連項目

Reporting Services SoapException クラス
SoapException エラー テーブル

その他の技術情報

Reporting Services における例外処理の概要

ヘルプおよび情報

SQL Server 2005 の参考資料の入手