DbException.SqlState 属性

定义

对于支持它的数据库提供程序,包含标准的 SQL 5 字符返回代码,该代码指示数据库操作是成功还是失败。For database providers which support it, contains a standard SQL 5-character return code indicating the success or failure of the database operation. 前 2 个字符表示返回代码的 (例如错误、成功),而最后 3 个字符表示 子类,允许以数据库可移植的方式检测错误情况。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.

对于不支持它的数据库提供程序,或对于不适用的错误方案,包含 nullFor database providers which don't support it, or for inapplicable error scenarios, contains null.

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

属性值

String

标准 SQL 5 个字符的返回代码,或 nullA standard SQL 5-character return code, or null.

适用于