DbException 類別

定義

代表資料來源擲回之所有例外狀況的基底類別。

public ref class DbException abstract : Exception
public ref class DbException abstract : System::Runtime::InteropServices::ExternalException
public abstract class DbException : Exception
public abstract class DbException : System.Runtime.InteropServices.ExternalException
[System.Serializable]
public abstract class DbException : System.Runtime.InteropServices.ExternalException
type DbException = class
    inherit Exception
type DbException = class
    inherit ExternalException
[<System.Serializable>]
type DbException = class
    inherit ExternalException
Public MustInherit Class DbException
Inherits Exception
Public MustInherit Class DbException
Inherits ExternalException
繼承
DbException
繼承
衍生
屬性

備註

類別 DbException 是抽象類別,做為提供者特定例外狀況類別實作的基類。

如需處理.NET Framework資料提供者例外狀況的一般資訊,請參閱 SqlException

建構函式

DbException()

初始化 DbException 類別的新執行個體。

DbException(SerializationInfo, StreamingContext)

使用指定的序列化資訊和內容,初始化 DbException 類別的新執行個體。

DbException(String)

使用指定的錯誤訊息,初始化 DbException 類別的新執行個體。

DbException(String, Exception)

初始化具有指定的錯誤訊息以及造成此例外狀況的內部例外狀況參考之 DbException 類別的新執行個體。

DbException(String, Int32)

使用指定的錯誤訊息和錯誤碼,初始化 DbException 類別的新執行個體。

屬性

BatchCommand

如果在執行 DbBatch 時擲回這個 DbException 值,則參考觸發例外狀況的特定 DbBatchCommand

Data

取得鍵值組的集合,這些鍵值組會提供關於例外狀況的其他使用者定義資訊。

(繼承來源 Exception)
DbBatchCommand

在衍生類別中覆寫時,如果在執行 DbBatch 時擲回, DbException 則會參考觸發例外狀況的特定 DbBatchCommand

ErrorCode

取得錯誤的 HRESULT

(繼承來源 ExternalException)
HelpLink

取得或設定與這個例外狀況相關聯的說明檔連結。

(繼承來源 Exception)
HResult

取得或設定 HRESULT,它是指派給特定例外狀況的編碼數值。

(繼承來源 Exception)
InnerException

取得造成目前例外狀況的 Exception 執行個體。

(繼承來源 Exception)
IsTransient

指出此 DbException 所代表的錯誤是否可能是暫時性錯誤,亦即,重試觸發作業是否可能會成功,而不需要任何其他變更。

Message

取得描述目前例外狀況的訊息。

(繼承來源 Exception)
Source

取得或設定造成錯誤的應用程式或物件的名稱。

(繼承來源 Exception)
SqlState

針對支援的資料庫提供者,包含標準 SQL 5 字元傳回碼,指出資料庫作業成功或失敗。 前 2 個字元代表傳回碼的類別 (例如錯誤、成功),而最後 3 個字元代表子類別,允許以資料庫可移植的方式偵測錯誤案例。

針對不支援的資料庫提供者,或不適用的錯誤案例,包含 null

StackTrace

取得呼叫堆疊上即時運算框架的字串表示。

(繼承來源 Exception)
TargetSite

取得擲回目前例外狀況的方法。

(繼承來源 Exception)

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetBaseException()

在衍生類別中覆寫時,傳回一或多個後續的例外狀況的根本原因 Exception

(繼承來源 Exception)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetObjectData(SerializationInfo, StreamingContext)

在衍生類別中覆寫時,使用例外狀況的資訊設定 SerializationInfo

(繼承來源 Exception)
GetType()

取得目前執行個體的執行階段類型。

(繼承來源 Exception)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

建立並傳回目前例外狀況的字串表示。

(繼承來源 Exception)
ToString()

傳回字串,其中包含錯誤的 HRESULT。

(繼承來源 ExternalException)

事件

SerializeObjectState
已過時。

當例外狀況序列化,以建立包含例外狀況相關序列化資料的例外狀況狀態物件時,就會發生此事件。

(繼承來源 Exception)

適用於

另請參閱