Прочетете на английски Редактиране

Споделяне чрез


OdbcErrorCollection Class

Definition

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

C#
public sealed class OdbcErrorCollection : System.Collections.ICollection
C#
[System.Serializable]
public sealed class OdbcErrorCollection : System.Collections.ICollection
Inheritance
OdbcErrorCollection
Attributes
Implements

Examples

The following example displays each OdbcError within the OdbcErrorCollection.

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 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

Gets the number of errors in the collection.

Item[Int32]

Gets the error at the specified index.

Methods

CopyTo(Array, Int32)

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

CopyTo(OdbcError[], Int32)

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

Equals(Object)

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

(Inherited from Object)
GetEnumerator()

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

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Explicit Interface Implementations

ICollection.IsSynchronized

For a description of this member, see IsSynchronized.

ICollection.SyncRoot

For a description of this member, see SyncRoot.

Extension Methods

Cast<TResult>(IEnumerable)

Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

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

AsParallel(IEnumerable)

Enables parallelization of a query.

AsQueryable(IEnumerable)

Converts an IEnumerable to an IQueryable.

Applies to

Продукт Версии
.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