Muokkaa

Jaa


OleDbException.Errors Property

Definition

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

public:
 property System::Data::OleDb::OleDbErrorCollection ^ Errors { System::Data::OleDb::OleDbErrorCollection ^ get(); };
public System.Data.OleDb.OleDbErrorCollection Errors { get; }
member this.Errors : System.Data.OleDb.OleDbErrorCollection
Public ReadOnly Property Errors As OleDbErrorCollection

Property Value

The collected instances of the OleDbError class.

Examples

The following example displays each OleDbError within the OleDbErrorCollection collection.

public void DisplayOleDbErrorCollection(OleDbException exception)
{
   for (int i=0; i < exception.Errors.Count; i++)
   {
      MessageBox.Show("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");
   }
}
Public Sub DisplayOleDbErrorCollection(exception As OleDbException)
    Dim i As Integer

    For i = 0 To exception.Errors.Count - 1
        MessageBox.Show("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
End Sub

Remarks

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

This is a wrapper for the OleDbErrorCollection collection.

Applies to

See also