Collects all errors generated by the .NET Framework Data Provider for OLE DB. This class cannot be inherited.
For a list of all members of this type, see OleDbErrorCollection Members.
System.Object
System.Data.OleDb.OleDbErrorCollection
[Visual Basic] <Serializable> NotInheritable Public Class OleDbErrorCollection Implements ICollection, IEnumerable [C#] [Serializable] public sealed class OleDbErrorCollection : ICollection, IEnumerable [C++] [Serializable] public __gc __sealed class OleDbErrorCollection : public ICollection, IEnumerable [JScript] public Serializable class OleDbErrorCollection implements ICollection, IEnumerable
Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.
This class is created by OleDbException to collect instances of the OleDbError class. OleDbErrorCollection always contains at least one instance of the OleDbError class.
[Visual Basic, C#] The following example displays each OleDbError within the OleDbErrorCollection collection.
[Visual Basic] Public Sub DisplayOleDbErrorCollection(myException As OleDbException) Dim i As Integer For i = 0 To myException.Errors.Count - 1 MessageBox.Show("Index #" + i.ToString() + ControlChars.Cr _ + "Message: " + myException.Errors(i).Message + ControlChars.Cr _ + "Native: " + myException.Errors(i).NativeError.ToString() + ControlChars.Cr _ + "Source: " + myException.Errors(i).Source + ControlChars.Cr _ + "SQL: " + myException.Errors(i).SQLState + ControlChars.Cr) Next i End Sub [C#] public void DisplayOleDbErrorCollection(OleDbException myException) { for (int i=0; i < myException.Errors.Count; i++) { MessageBox.Show("Index #" + i + "\n" + "Message: " + myException.Errors[i].Message + "\n" + "Native: " + myException.Errors[i].NativeError.ToString() + "\n" + "Source: " + myException.Errors[i].Source + "\n" + "SQL: " + myException.Errors[i].SQLState + "\n"); } }
[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button
in the upper-left corner of the page.
Namespace: System.Data.OleDb
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Assembly: System.Data (in System.Data.dll)
OleDbErrorCollection Members | System.Data.OleDb Namespace | OleDbError | OleDbException