System.Data [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00] 1.0.3300.0 1.0.5000.0 2.0.0.0 Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details. System.Data.Common.DbException

This class is created whenever the .NET Framework Data Provider for SQL Server encounters an error generated from the server. (Client side errors are thrown as standard common language runtime exceptions.) always contains at least one instance of .

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 remains open when the severity level is 19 or less. When the severity level is 20 or greater, the server ordinarily closes the . However, the user can reopen the connection and continue. In both cases, a 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 SQL Server Books Online. The class maps to SQL Server severity.

The following is general information on handling exceptions. Your code should catch exceptions to prevent the application from crashing and to allow displaying a relevant error message to the user. You can use database transactions to ensure that the data is consistent regardless of what happens in the client application (including a crash). Features like System.Transaction.TransactionScope or the BeginTransaction method (in System.Data.OleDb.OleDbConnection, System.Data.ODBC.ODBCConnection, and System.Data.SqlClient.SqlConnection) ensure consistent data regardless of exceptions raised by a provider. Transactions can fail, so catch failures and retry the transaction.

The exception class of a .Net Framework data provider reports provider-specific errors. For example System.Data.Odbc has OdbcException, System.Data.OleDb has OleDbException, and System.Data.SqlClient has SqlException. For the best level of error detail, catch these exceptions and use the members of these exception classes to get details of the error.

In addition to the provider-specific errors, .NET Framework data provider types can raise .NET Framework exceptions such as System.OutOfMemoryException and System.Threading.ThreadAbortException. Recovery from these exceptions may not be possible.

Bad input can cause a .NET Framework data provider type to raise an exception such as System.ArgumentException or System.IndexOutOfRangeException. Calling a method at the wrong time can raise System.InvalidOperationException.

So, in general, write an exception handler that catches the provider specific exception as well as exceptions from the common language runtime. These can be layered as follows:

`Try { // code here } catch (SqlException odbcEx) { // Handle more specific SqlException exception here. } catch (Exception ex) { // Handle generic ones here. }`

Or:

`Try { // code here } catch (Exception ex) { if (ex is SqlException) { // Handle more specific SqlException exception here. } Else { // Handle generic ones here. } }`

It is also possible for a .NET Framework data provider method call to fail on a thread pool thread with no user code on the stack. In this case, and when using asynchronous method calls, you must register the event to handle those exceptions and avoid application crash.

The exception that is thrown when SQL Server returns a warning or error. This class cannot be inherited.

- Property
  System.Byte To be added: an object of type 'byte'

  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 remains open when the severity level is 19 or less. When the severity level is 20 or greater, the server ordinarily closes the . However, the user can reopen the connection and continue. In both cases, a 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 property of the first in the property.

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

  1.0.5000.0
  2.0.0.0
- Property
  System.Data.SqlClient.SqlErrorCollection To be added: an object of type 'SqlErrorCollection'

  The class always contains at least one instance of the class.

  This is a wrapper for . For more information on SQL Server engine errors, see SQL Server Books Online.

  Gets a collection of one or more objects that give detailed information about exceptions generated by the .NET Framework Data Provider for SQL Server.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)
- Method
  System.Void `` ``

  GetObjectData sets a SerializationInfo with all the exception object data targeted for serialization. During deserialization, the exception is reconstituted from the SerializationInfo transmitted over the stream.

  Sets the with information about the exception.

  The that holds the serialized object data about the exception being thrown. The that contains contextual information about the source or destination. 1.0.5000.0 2.0.0.0
- Property
  System.Int32 To be added: an object of type 'int'

  The line numbering starts at 1; if 0 is returned, the line number is not applicable.

  This is a wrapper for the property of the first in the property.

  Gets the line number within the Transact-SQL command batch or stored procedure that generated the error.

  1.0.5000.0
  2.0.0.0
- Property
  System.String To be added To be added: an object of type 'string' To be added 1.0.5000.0 2.0.0.0
- Property
  System.Int32 To be added: an object of type 'int'

  This is a wrapper for the property of the first in the property. For more information on SQL Server engine errors, see SQL Server Books Online.

  Gets a number that identifies the type of error.

  1.0.5000.0
  2.0.0.0
- Property
  System.String To be added: an object of type 'string'

  This is a wrapper for the property of the first in the property.

  Gets the name of the stored procedure or remote procedure call (RPC) that generated the error.

  1.0.5000.0
  2.0.0.0
- Property
  System.String To be added: an object of type 'string'

  This is a wrapper for the property of the first in the property.

  Gets the name of the computer that is running an instance of SQL Server that generated the error.

  1.0.5000.0
  2.0.0.0
- Property
  System.String To be added: an object of type 'string'

  This is a wrapper for the property of the first in the property.

  Gets the name of the provider that generated the error.

  1.0.5000.0
  2.0.0.0
- Property
  System.Byte To be added: an object of type 'byte'

  This is a wrapper for the property of the first in the property.

  Gets a numeric error code from SQL Server that represents an error, warning or "no data found" message. For more information about how to decode these values, see SQL Server Books Online.

  1.0.5000.0
  2.0.0.0