OdbcException.Errors Property

Definition

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

C#
public System.Data.Odbc.OdbcErrorCollection Errors { get; }

Property Value

The collected instances of the OdbcError class.

Examples

The following example displays each OdbcError within an OdbcErrorCollection collection.

C#
public void DisplayOdbcErrorCollection(OdbcException 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");
   }
}

Remarks

This property is a wrapper for the OdbcErrorCollection.

Applies to

Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)

See also