DbException.SqlState Property


For database providers which support it, contains a standard SQL 5-character return code indicating the success or failure of the database operation. The first 2 characters represent the class of the return code (e.g. error, success), while the last 3 characters represent the subclass, allowing detection of error scenarios in a database-portable way.

For database providers which don't support it, or for inapplicable error scenarios, contains null.

 virtual property System::String ^ SqlState { System::String ^ get(); };
public virtual string? SqlState { get; }
member this.SqlState : string
Public Overridable ReadOnly Property SqlState As String

Property Value


A standard SQL 5-character return code, or null.

Applies to