OdbcErrorCollection Class

OdbcErrorCollection Class

 

Collects all errors generated by the OdbcDataAdapter. This class cannot be inherited.

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

System.Object
  System.Data.Odbc.OdbcErrorCollection

[SerializableAttribute]
public sealed class OdbcErrorCollection : ICollection, IEnumerable

NameDescription
System_CAPS_pubpropertyCount

Gets the number of errors in the collection.

System_CAPS_pubpropertyItem[Int32]

Gets the error at the specified index.

NameDescription
System_CAPS_pubmethodCopyTo(Array, Int32)

Copies the elements of the OdbcErrorCollection into an array, starting at the specified index within the array.

System_CAPS_pubmethodCopyTo(OdbcError[], Int32)

Copies all the elements of the current OdbcErrorCollection to the specified OdbcErrorCollection starting at the specified destination index.

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodGetEnumerator()

Returns an object that implements the T:System.Collections.IEnumerator interface and that can iterate through the OdbcErrorCollection objects in the OdbcErrorCollection.

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privpropertyICollection.IsSynchronized

For a description of this member, see IsSynchronized.

System_CAPS_pubinterfaceSystem_CAPS_privpropertyICollection.SyncRoot

For a description of this member, see SyncRoot.

NameDescription
System_CAPS_pubmethodAsParallel()

Overloaded. Enables parallelization of a query.(Defined by ParallelEnumerable.)

System_CAPS_pubmethodAsQueryable()

Overloaded. Converts an IEnumerable to an IQueryable.(Defined by Queryable.)

System_CAPS_pubmethodCast<TResult>()

Casts the elements of an IEnumerable to the specified type.(Defined by Enumerable.)

System_CAPS_pubmethodOfType<TResult>()

Filters the elements of an IEnumerable based on a specified type.(Defined by Enumerable.)

This class is created by OdbcException to collect instances of the OdbcError class. OdbcErrorCollection always contains at least one instance of the OdbcError class.

The following example displays each OdbcError within the OdbcErrorCollection.

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");
   }
}

.NET Framework
Available since 1.1

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2016 Microsoft