OleDbErrorCollection Class
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Collects all errors generated by the .NET Framework Data Provider for OLE DB. This class cannot be inherited.
public ref class OleDbErrorCollection sealed : System::Collections::ICollection
[System.ComponentModel.ListBindable(false)]
public sealed class OleDbErrorCollection : System.Collections.ICollection
[System.ComponentModel.ListBindable(false)]
[System.Serializable]
public sealed class OleDbErrorCollection : System.Collections.ICollection
[<System.ComponentModel.ListBindable(false)>]
type OleDbErrorCollection = class
interface ICollection
interface IEnumerable
[<System.ComponentModel.ListBindable(false)>]
[<System.Serializable>]
type OleDbErrorCollection = class
interface ICollection
interface IEnumerable
Public NotInheritable Class OleDbErrorCollection
Implements ICollection
- Inheritance
-
OleDbErrorCollection
- Attributes
- Implements
The following example displays each OleDbError within the OleDbErrorCollection collection.
public void DisplayOleDbErrorCollection(OleDbException 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 DisplayOleDbErrorCollection(exception As OleDbException)
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
This class is created by OleDbException to collect instances of the OleDbError class. OleDbErrorCollection always contains at least one instance of the OleDbError class.
Count |
Gets the number of errors in the collection. |
Item[Int32] |
Gets the error at the specified index. |
Copy |
Copies the elements of the OleDbErrorCollection into an Array, starting at the specified index within the Array. |
Copy |
Copies all the elements of the current OleDbErrorCollection to the specified OleDbErrorCollection starting at the specified destination index. |
Equals(Object) |
Determines whether the specified object is equal to the current object. (Inherited from Object) |
Get |
Exposes the GetEnumerator() method, which supports a simple iteration over a collection by a .NET Framework data provider. |
Get |
Serves as the default hash function. (Inherited from Object) |
Get |
Gets the Type of the current instance. (Inherited from Object) |
Memberwise |
Creates a shallow copy of the current Object. (Inherited from Object) |
To |
Returns a string that represents the current object. (Inherited from Object) |
ICollection. |
For a description of this member, see IsSynchronized. |
ICollection. |
For a description of this member, see SyncRoot. |
Cast<TResult>(IEnumerable) |
Casts the elements of an IEnumerable to the specified type. |
Of |
Filters the elements of an IEnumerable based on a specified type. |
As |
Enables parallelization of a query. |
As |
Converts an IEnumerable to an IQueryable. |
Product | Versions |
---|---|
.NET | 8 (package-provided), 9 (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 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
.NET feedback
.NET is an open source project. Select a link to provide feedback: