ערוך

שתף באמצעות


OleDbError Class

Definition

Collects information relevant to a warning or error returned by the data source.

public ref class OleDbError sealed
public sealed class OleDbError
[System.Serializable]
public sealed class OleDbError
type OleDbError = class
[<System.Serializable>]
type OleDbError = class
Public NotInheritable Class OleDbError
Inheritance
OleDbError
Attributes

Examples

The following example displays the properties of the OleDbError.

public void DisplayOleDbErrorCollection(OleDbException exception)
{
    for (int i = 0; i < exception.Errors.Count; i++)
    {
        Console.WriteLine("Index #" + i + "\n" +
            "Message: " + exception.Errors[i].Message + "\n" +
            "Native: " + exception.Errors[i].NativeError.ToString() + "\n" +
            "Source: " + exception.Errors[i].Source + "\n" +
            "SQL: " + exception.Errors[i].SQLState + "\n");
    }
    Console.ReadLine();
}
Public Sub DisplayOleDbErrorCollection(ByVal exception As OleDbException)
    Dim i As Integer

    For i = 0 To exception.Errors.Count - 1
        Console.WriteLine("Index #" & i.ToString() & ControlChars.Cr _
           & "Message: " & exception.Errors(i).Message & ControlChars.Cr _
           & "Native: " & exception.Errors(i).NativeError.ToString() & ControlChars.Cr _
           & "Source: " & exception.Errors(i).Source & ControlChars.Cr _
           & "SQL: " & exception.Errors(i).SQLState & ControlChars.Cr)
    Next i
    Console.ReadLine()
End Sub

Remarks

This class is created by the OleDb data adapter when an error occurs. An instance of OleDbError is created and managed by the OleDbErrorCollection class, which in turn is created by the OleDbException class.

If the severity of the error is too great, the server may close the OleDbConnection. However, the user can reopen the connection and continue.

Properties

Message

Gets a short description of the error.

NativeError

Gets the database-specific error information.

Source

Gets the name of the provider that generated the error.

SQLState

Gets the five-character error code following the ANSI SQL standard for the database.

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Gets the complete text of the error message.

Applies to

See also