DbException Constructors

Definition

Initializes a new instance of the DbException class.

Overloads

DbException()

Initializes a new instance of the DbException class.

DbException(String)

Initializes a new instance of the DbException class with the specified error message.

DbException(SerializationInfo, StreamingContext)
Obsolete.

Initializes a new instance of the DbException class with the specified serialization information and context.

DbException(String, Exception)

Initializes a new instance of the DbException class with the specified error message and a reference to the inner exception that is the cause of this exception.

DbException(String, Int32)

Initializes a new instance of the DbException class with the specified error message and error code.

Remarks

The DbException class is an abstract class used as the base class for provider-specific exception class implementations.

DbException()

Source:
DbException.cs
Source:
DbException.cs
Source:
DbException.cs

Initializes a new instance of the DbException class.

protected:
 DbException();
protected DbException ();
Protected Sub New ()

Remarks

The DbException class is an abstract class used as the base class for provider-specific exception class implementations.

See also

Applies to

DbException(String)

Source:
DbException.cs
Source:
DbException.cs
Source:
DbException.cs

Initializes a new instance of the DbException class with the specified error message.

protected:
 DbException(System::String ^ message);
protected DbException (string message);
protected DbException (string? message);
new System.Data.Common.DbException : string -> System.Data.Common.DbException
Protected Sub New (message As String)

Parameters

message
String

The message to display for this exception.

Remarks

The DbException class is an abstract class used as the base class for provider-specific exception class implementations.

See also

Applies to

DbException(SerializationInfo, StreamingContext)

Source:
DbException.cs
Source:
DbException.cs
Source:
DbException.cs

Caution

This API supports obsolete formatter-based serialization. It should not be called or extended by application code.

Initializes a new instance of the DbException class with the specified serialization information and context.

protected:
 DbException(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected DbException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
[System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
protected DbException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new System.Data.Common.DbException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Data.Common.DbException
[<System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
new System.Data.Common.DbException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Data.Common.DbException
Protected Sub New (info As SerializationInfo, context As StreamingContext)

Parameters

info
SerializationInfo

The SerializationInfo that holds the serialized object data about the exception being thrown.

context
StreamingContext

The StreamingContext that contains contextual information about the source or destination.

Attributes

Remarks

The DbException class is an abstract class used as the base class for provider-specific exception class implementations.

See also

Applies to

DbException(String, Exception)

Source:
DbException.cs
Source:
DbException.cs
Source:
DbException.cs

Initializes a new instance of the DbException class with the specified error message and a reference to the inner exception that is the cause of this exception.

protected:
 DbException(System::String ^ message, Exception ^ innerException);
protected DbException (string message, Exception innerException);
protected DbException (string? message, Exception? innerException);
new System.Data.Common.DbException : string * Exception -> System.Data.Common.DbException
Protected Sub New (message As String, innerException As Exception)

Parameters

message
String

The error message string.

innerException
Exception

The inner exception reference.

Remarks

The DbException class is an abstract class used as the base class for provider-specific exception class implementations.

See also

Applies to

DbException(String, Int32)

Source:
DbException.cs
Source:
DbException.cs
Source:
DbException.cs

Initializes a new instance of the DbException class with the specified error message and error code.

protected:
 DbException(System::String ^ message, int errorCode);
protected DbException (string? message, int errorCode);
protected DbException (string message, int errorCode);
new System.Data.Common.DbException : string * int -> System.Data.Common.DbException
Protected Sub New (message As String, errorCode As Integer)

Parameters

message
String

The error message that explains the reason for the exception.

errorCode
Int32

The error code for the exception.

Remarks

The DbException class is an abstract class used as the base class for provider-specific exception class implementations.

See also

Applies to