OleDbErrorCollection::Item Property (Int32)

 

Gets the error at the specified index.

Namespace:   System.Data.OleDb
Assembly:  System.Data (in System.Data.dll)

public:
property OleDbError^ default[
	int index
] {
	OleDbError^ get(int index);
}

Parameters

index
Type: System::Int32

The zero-based index of the error to retrieve.

Property Value

Type: System.Data.OleDb::OleDbError^

An OleDbError that contains the error at the specified index.

The following example displays each OleDbError within the OleDbErrorCollection collection.

public void DisplayOleDbErrorCollection(OleDbException myException) 
  {
     for (int i=0; i < myException.Errors.Count; i++)
     {
        MessageBox.Show("Index #" + i + "\n" +
               "Message: " + myException.Errors[i].Message + "\n" +
               "Native: " + myException.Errors[i].NativeError.ToString() + "\n" +
               "Source: " + myException.Errors[i].Source + "\n" +
               "SQL: " + myException.Errors[i].SQLState + "\n");
     }
  }

.NET Framework
Available since 1.1
Return to top
Show: