''SqlError'' ''serializable'

SqlError serializable

System.Data.SqlClient (system.data.dll) sealed class

This class represents one or more data source errors, but it isn't an exception. Instead, the data source may report multiple errors, and multiple SqlError instances may be added to a single SqlErrorCollection , which are then accessed using the SqlException.Errors property of the exception that is raised.

SQL Server errors contain information about the command causing the error (Procedure provides the procedure name, and LineNumber indicates which statement failed), the instance of SQL Server where the error occurred (Server ), and a descriptive text message (Message ). Additional numeric information is provided, such as the error code (State ) that can be "translated" using the SQL Server 2000 Books Online, a number that indicates the type of error and maps to an entry in the master.dbo.sysmessages table (Number ), and a severity level from 1 to 25 (Class ). Messages with a severity level of 10 or less are informational. All errors of level 16 or less are probably generated by the user (for example, invalid input or a miscoded stored procedure) and can be corrected by the user. Severity levels from 17 through 25 indicate software or hardware errors. The SqlConnection remains open if the severity level is 19 or less; if the severity level is 20 or greater, the server usually closes the connection. However, you can reopen the connection and attempt to continue. Severity levels of 20 or above are fatal and usually prevent any work from being accomplished with SQL Server. For information on SQL Server's warning and informational messages, refer to the Troubleshooting section of the SQL Server 2000 Books Online documentation.

public sealed class SqlError {
// Public Instance Properties
   public byte Class{get; } 
   public int LineNumber{get; } 
   public string Message{get; } 
   public int Number{get; } 
   public string Procedure{get; } 
   public string Server{get; } 
   public string Source{get; } 
   public byte State{get; } 
// Public Instance Methods
   public override string ToString(  );                  // overrides object

Returned By


    Part I: ADO.NET Tutorial
    Part II: ADO.NET Core Classes
    Part III: API Quick Reference
    Chapter 34. The System.Data Namespace