Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Class Property

SqlException::Class Property

Gets the severity level of the error returned from the .NET Framework Data Provider for SQL Server.

Namespace:  System.Data.SqlClient
Assembly:  System.Data (in System.Data.dll)

public:
property unsigned char Class {
	unsigned char get ();
}

Property Value

Type: System::Byte
A value from 1 to 25 that indicates the severity level of the error.

Messages that have a severity level of 10 or less are informational and indicate problems caused by mistakes in information that a user has entered. Severity levels from 11 through 16 are generated by the user, and can be corrected by the user. Severity levels from 17 through 25 indicate software or hardware errors. When a level 17, 18, or 19 error occurs, you can continue working, although you might not be able to execute a particular statement.

The SqlConnection remains open when the severity level is 19 or less. When the severity level is 20 or greater, the server ordinarily closes the SqlConnection. However, the user can reopen the connection and continue. In both cases, a SqlException is generated by the method executing the command.

For information about the warning and informational messages sent by SQL Server, see the Troubleshooting section of the SQL Server documentation.

This is a wrapper for the Class property of the first SqlError in the Errors property.

The following example displays each SqlError within the SqlErrorCollection collection.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft