a575963da9
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
292 lines
18 KiB
XML
292 lines
18 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<Type Name="SqlException" FullName="System.Data.SqlClient.SqlException">
|
|
<TypeSignature Language="C#" Maintainer="auto" Value="public sealed class SqlException : System.Data.Common.DbException" />
|
|
<AssemblyInfo>
|
|
<AssemblyName>System.Data</AssemblyName>
|
|
<AssemblyPublicKey>[00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00]</AssemblyPublicKey>
|
|
<AssemblyVersion>1.0.3300.0</AssemblyVersion>
|
|
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
|
|
<AssemblyVersion>2.0.0.0</AssemblyVersion>
|
|
</AssemblyInfo>
|
|
<ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details.</ThreadSafetyStatement>
|
|
<Base>
|
|
<BaseTypeName>System.Data.Common.DbException</BaseTypeName>
|
|
</Base>
|
|
<Interfaces>
|
|
</Interfaces>
|
|
<Docs>
|
|
<remarks>
|
|
<attribution license="cc4" from="Microsoft" modified="false" />
|
|
<para>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.) <see cref="T:System.Data.SqlClient.SqlException" /> always contains at least one instance of <see cref="T:System.Data.SqlClient.SqlError" />.</para>
|
|
<para>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.</para>
|
|
<para>The <see cref="T:System.Data.SqlClient.SqlConnection" /> remains open when the severity level is 19 or less. When the severity level is 20 or greater, the server ordinarily closes the <see cref="T:System.Data.SqlClient.SqlConnection" />. However, the user can reopen the connection and continue. In both cases, a <see cref="T:System.Data.SqlClient.SqlException" /> is generated by the method executing the command.</para>
|
|
<para>For information about the warning and informational messages sent by SQL Server, see the Troubleshooting section of SQL Server Books Online. The <see cref="T:System.Data.SqlClient.SqlException" /> class maps to SQL Server severity.</para>
|
|
<para>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.</para>
|
|
<para>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.</para>
|
|
<para>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.</para>
|
|
<para>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.</para>
|
|
<para>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:</para>
|
|
<code>Try {
|
|
// code here
|
|
}
|
|
catch (SqlException odbcEx) {
|
|
// Handle more specific SqlException exception here.
|
|
}
|
|
catch (Exception ex) {
|
|
// Handle generic ones here.
|
|
}
|
|
</code>
|
|
<para>Or:</para>
|
|
<code>Try {
|
|
// code here
|
|
}
|
|
catch (Exception ex) {
|
|
if (ex is SqlException) {
|
|
// Handle more specific SqlException exception here.
|
|
}
|
|
Else {
|
|
// Handle generic ones here.
|
|
}
|
|
}
|
|
</code>
|
|
<para>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 <see cref="E:System.AppDomain.UnhandledException" /> event to handle those exceptions and avoid application crash.</para>
|
|
</remarks>
|
|
<summary>
|
|
<attribution license="cc4" from="Microsoft" modified="false" />
|
|
<para>The exception that is thrown when SQL Server returns a warning or error. This class cannot be inherited.</para>
|
|
</summary>
|
|
</Docs>
|
|
<Members>
|
|
<Member MemberName="Class">
|
|
<MemberSignature Language="C#" Value="public byte Class { get; }" />
|
|
<MemberType>Property</MemberType>
|
|
<ReturnValue>
|
|
<ReturnType>System.Byte</ReturnType>
|
|
</ReturnValue>
|
|
<Docs>
|
|
<value>To be added: an object of type 'byte'</value>
|
|
<remarks>
|
|
<attribution license="cc4" from="Microsoft" modified="false" />
|
|
<para>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.</para>
|
|
<para>The <see cref="T:System.Data.SqlClient.SqlConnection" /> remains open when the severity level is 19 or less. When the severity level is 20 or greater, the server ordinarily closes the <see cref="T:System.Data.SqlClient.SqlConnection" />. However, the user can reopen the connection and continue. In both cases, a <see cref="T:System.Data.SqlClient.SqlException" /> is generated by the method executing the command.</para>
|
|
<para>For information about the warning and informational messages sent by SQL Server, see the Troubleshooting section of the SQL Server documentation.</para>
|
|
<para>This is a wrapper for the <see cref="P:System.Data.SqlClient.SqlError.Class" /> property of the first <see cref="T:System.Data.SqlClient.SqlError" /> in the <see cref="P:System.Data.SqlClient.SqlException.Errors" /> property.</para>
|
|
</remarks>
|
|
<summary>
|
|
<attribution license="cc4" from="Microsoft" modified="false" />
|
|
<para>Gets the severity level of the error returned from the .NET Framework Data Provider for SQL Server.</para>
|
|
</summary>
|
|
</Docs>
|
|
<AssemblyInfo>
|
|
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
|
|
<AssemblyVersion>2.0.0.0</AssemblyVersion>
|
|
</AssemblyInfo>
|
|
</Member>
|
|
<Member MemberName="Errors">
|
|
<MemberSignature Language="C#" Value="public System.Data.SqlClient.SqlErrorCollection Errors { get; }" />
|
|
<MemberType>Property</MemberType>
|
|
<ReturnValue>
|
|
<ReturnType>System.Data.SqlClient.SqlErrorCollection</ReturnType>
|
|
</ReturnValue>
|
|
<Docs>
|
|
<value>To be added: an object of type 'SqlErrorCollection'</value>
|
|
<remarks>
|
|
<attribution license="cc4" from="Microsoft" modified="false" />
|
|
<para>The <see cref="T:System.Data.SqlClient.SqlErrorCollection" /> class always contains at least one instance of the <see cref="T:System.Data.SqlClient.SqlError" /> class.</para>
|
|
<para>This is a wrapper for <see cref="T:System.Data.SqlClient.SqlErrorCollection" />. For more information on SQL Server engine errors, see SQL Server Books Online.</para>
|
|
</remarks>
|
|
<summary>
|
|
<attribution license="cc4" from="Microsoft" modified="false" />
|
|
<para>Gets a collection of one or more <see cref="T:System.Data.SqlClient.SqlError" /> objects that give detailed information about exceptions generated by the .NET Framework Data Provider for SQL Server.</para>
|
|
</summary>
|
|
</Docs>
|
|
<AssemblyInfo>
|
|
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
|
|
<AssemblyVersion>2.0.0.0</AssemblyVersion>
|
|
</AssemblyInfo>
|
|
<Attributes>
|
|
<Attribute>
|
|
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)</AttributeName>
|
|
</Attribute>
|
|
</Attributes>
|
|
</Member>
|
|
<Member MemberName="GetObjectData">
|
|
<MemberSignature Language="C#" Value="public override void GetObjectData (System.Runtime.Serialization.SerializationInfo si, System.Runtime.Serialization.StreamingContext context);" />
|
|
<MemberType>Method</MemberType>
|
|
<ReturnValue>
|
|
<ReturnType>System.Void</ReturnType>
|
|
</ReturnValue>
|
|
<Parameters>
|
|
<Parameter Name="si" Type="System.Runtime.Serialization.SerializationInfo" />
|
|
<Parameter Name="context" Type="System.Runtime.Serialization.StreamingContext" />
|
|
</Parameters>
|
|
<Docs>
|
|
<remarks>
|
|
<attribution license="cc4" from="Microsoft" modified="false" />
|
|
<para>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.</para>
|
|
</remarks>
|
|
<summary>
|
|
<attribution license="cc4" from="Microsoft" modified="false" />
|
|
<para>Sets the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> with information about the exception.</para>
|
|
</summary>
|
|
<param name="si">
|
|
<attribution license="cc4" from="Microsoft" modified="false" />The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown. </param>
|
|
<param name="context">
|
|
<attribution license="cc4" from="Microsoft" modified="false" />The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination.</param>
|
|
</Docs>
|
|
<AssemblyInfo>
|
|
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
|
|
<AssemblyVersion>2.0.0.0</AssemblyVersion>
|
|
</AssemblyInfo>
|
|
</Member>
|
|
<Member MemberName="LineNumber">
|
|
<MemberSignature Language="C#" Value="public int LineNumber { get; }" />
|
|
<MemberType>Property</MemberType>
|
|
<ReturnValue>
|
|
<ReturnType>System.Int32</ReturnType>
|
|
</ReturnValue>
|
|
<Docs>
|
|
<value>To be added: an object of type 'int'</value>
|
|
<remarks>
|
|
<attribution license="cc4" from="Microsoft" modified="false" />
|
|
<para>The line numbering starts at 1; if 0 is returned, the line number is not applicable.</para>
|
|
<para>This is a wrapper for the <see cref="P:System.Data.SqlClient.SqlError.LineNumber" /> property of the first <see cref="T:System.Data.SqlClient.SqlError" /> in the <see cref="P:System.Data.SqlClient.SqlException.Errors" /> property. </para>
|
|
</remarks>
|
|
<summary>
|
|
<attribution license="cc4" from="Microsoft" modified="false" />
|
|
<para>Gets the line number within the Transact-SQL command batch or stored procedure that generated the error.</para>
|
|
</summary>
|
|
</Docs>
|
|
<AssemblyInfo>
|
|
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
|
|
<AssemblyVersion>2.0.0.0</AssemblyVersion>
|
|
</AssemblyInfo>
|
|
</Member>
|
|
<Member MemberName="Message">
|
|
<MemberSignature Language="C#" Value="public override string Message { get; }" />
|
|
<MemberType>Property</MemberType>
|
|
<ReturnValue>
|
|
<ReturnType>System.String</ReturnType>
|
|
</ReturnValue>
|
|
<Docs>
|
|
<summary>To be added</summary>
|
|
<value>To be added: an object of type 'string'</value>
|
|
<remarks>To be added</remarks>
|
|
</Docs>
|
|
<AssemblyInfo>
|
|
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
|
|
<AssemblyVersion>2.0.0.0</AssemblyVersion>
|
|
</AssemblyInfo>
|
|
</Member>
|
|
<Member MemberName="Number">
|
|
<MemberSignature Language="C#" Value="public int Number { get; }" />
|
|
<MemberType>Property</MemberType>
|
|
<ReturnValue>
|
|
<ReturnType>System.Int32</ReturnType>
|
|
</ReturnValue>
|
|
<Docs>
|
|
<value>To be added: an object of type 'int'</value>
|
|
<remarks>
|
|
<attribution license="cc4" from="Microsoft" modified="false" />
|
|
<para>This is a wrapper for the <see cref="P:System.Data.SqlClient.SqlError.Number" /> property of the first <see cref="T:System.Data.SqlClient.SqlError" /> in the <see cref="P:System.Data.SqlClient.SqlException.Errors" /> property. For more information on SQL Server engine errors, see SQL Server Books Online.</para>
|
|
</remarks>
|
|
<summary>
|
|
<attribution license="cc4" from="Microsoft" modified="false" />
|
|
<para>Gets a number that identifies the type of error.</para>
|
|
</summary>
|
|
</Docs>
|
|
<AssemblyInfo>
|
|
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
|
|
<AssemblyVersion>2.0.0.0</AssemblyVersion>
|
|
</AssemblyInfo>
|
|
</Member>
|
|
<Member MemberName="Procedure">
|
|
<MemberSignature Language="C#" Value="public string Procedure { get; }" />
|
|
<MemberType>Property</MemberType>
|
|
<ReturnValue>
|
|
<ReturnType>System.String</ReturnType>
|
|
</ReturnValue>
|
|
<Docs>
|
|
<value>To be added: an object of type 'string'</value>
|
|
<remarks>
|
|
<attribution license="cc4" from="Microsoft" modified="false" />
|
|
<para>This is a wrapper for the <see cref="P:System.Data.SqlClient.SqlError.Procedure" /> property of the first <see cref="T:System.Data.SqlClient.SqlError" /> in the <see cref="P:System.Data.SqlClient.SqlException.Errors" /> property. </para>
|
|
</remarks>
|
|
<summary>
|
|
<attribution license="cc4" from="Microsoft" modified="false" />
|
|
<para>Gets the name of the stored procedure or remote procedure call (RPC) that generated the error.</para>
|
|
</summary>
|
|
</Docs>
|
|
<AssemblyInfo>
|
|
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
|
|
<AssemblyVersion>2.0.0.0</AssemblyVersion>
|
|
</AssemblyInfo>
|
|
</Member>
|
|
<Member MemberName="Server">
|
|
<MemberSignature Language="C#" Value="public string Server { get; }" />
|
|
<MemberType>Property</MemberType>
|
|
<ReturnValue>
|
|
<ReturnType>System.String</ReturnType>
|
|
</ReturnValue>
|
|
<Docs>
|
|
<value>To be added: an object of type 'string'</value>
|
|
<remarks>
|
|
<attribution license="cc4" from="Microsoft" modified="false" />
|
|
<para>This is a wrapper for the <see cref="P:System.Data.SqlClient.SqlError.Server" /> property of the first <see cref="T:System.Data.SqlClient.SqlError" /> in the <see cref="P:System.Data.SqlClient.SqlException.Errors" /> property. </para>
|
|
</remarks>
|
|
<summary>
|
|
<attribution license="cc4" from="Microsoft" modified="false" />
|
|
<para>Gets the name of the computer that is running an instance of SQL Server that generated the error.</para>
|
|
</summary>
|
|
</Docs>
|
|
<AssemblyInfo>
|
|
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
|
|
<AssemblyVersion>2.0.0.0</AssemblyVersion>
|
|
</AssemblyInfo>
|
|
</Member>
|
|
<Member MemberName="Source">
|
|
<MemberSignature Language="C#" Value="public override string Source { get; }" />
|
|
<MemberType>Property</MemberType>
|
|
<ReturnValue>
|
|
<ReturnType>System.String</ReturnType>
|
|
</ReturnValue>
|
|
<Docs>
|
|
<value>To be added: an object of type 'string'</value>
|
|
<remarks>
|
|
<attribution license="cc4" from="Microsoft" modified="false" />
|
|
<para>This is a wrapper for the <see cref="P:System.Data.SqlClient.SqlError.Source" /> property of the first <see cref="T:System.Data.SqlClient.SqlError" /> in the <see cref="P:System.Data.SqlClient.SqlException.Errors" /> property. </para>
|
|
</remarks>
|
|
<summary>
|
|
<attribution license="cc4" from="Microsoft" modified="false" />
|
|
<para>Gets the name of the provider that generated the error.</para>
|
|
</summary>
|
|
</Docs>
|
|
<AssemblyInfo>
|
|
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
|
|
<AssemblyVersion>2.0.0.0</AssemblyVersion>
|
|
</AssemblyInfo>
|
|
</Member>
|
|
<Member MemberName="State">
|
|
<MemberSignature Language="C#" Value="public byte State { get; }" />
|
|
<MemberType>Property</MemberType>
|
|
<ReturnValue>
|
|
<ReturnType>System.Byte</ReturnType>
|
|
</ReturnValue>
|
|
<Docs>
|
|
<value>To be added: an object of type 'byte'</value>
|
|
<remarks>
|
|
<attribution license="cc4" from="Microsoft" modified="false" />
|
|
<para>This is a wrapper for the <see cref="P:System.Data.SqlClient.SqlError.State" /> property of the first <see cref="T:System.Data.SqlClient.SqlError" /> in the <see cref="P:System.Data.SqlClient.SqlException.Errors" /> property. </para>
|
|
</remarks>
|
|
<summary>
|
|
<attribution license="cc4" from="Microsoft" modified="false" />
|
|
<para>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.</para>
|
|
</summary>
|
|
</Docs>
|
|
<AssemblyInfo>
|
|
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
|
|
<AssemblyVersion>2.0.0.0</AssemblyVersion>
|
|
</AssemblyInfo>
|
|
</Member>
|
|
</Members>
|
|
</Type> |