OdbcErrorCollection OdbcErrorCollection OdbcErrorCollection OdbcErrorCollection Class

Definition

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

public ref class OdbcErrorCollection sealed : System::Collections::ICollection
[System.Serializable]
public sealed class OdbcErrorCollection : System.Collections.ICollection
type OdbcErrorCollection = class
    interface ICollection
    interface IEnumerable
Public NotInheritable Class OdbcErrorCollection
Implements ICollection
Inheritance
OdbcErrorCollectionOdbcErrorCollectionOdbcErrorCollectionOdbcErrorCollection
Attributes
Implements

Examples

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");
   }
}
Public Sub DisplayOdbcErrorCollection(exception As OdbcException)
    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

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

Properties

Count Count Count Count

Gets the number of errors in the collection.

Item[Int32] Item[Int32] Item[Int32] Item[Int32]

Gets the error at the specified index.

Methods

CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32)

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

CopyTo(OdbcError[], Int32) CopyTo(OdbcError[], Int32) CopyTo(OdbcError[], Int32) CopyTo(OdbcError[], Int32)

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

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

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

(Inherited from Object)
GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

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

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Explicit Interface Implementations

ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized

For a description of this member, see IsSynchronized.

ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot

For a description of this member, see SyncRoot.

Extension Methods

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

Converts an IEnumerable to an IQueryable.

Applies to

See also