System.Data.OleDb Namespace
Collects all errors generated by the adapter.
This class is created by OleDbException to collect instances of the OleDbError class. OleDbErrorCollection always contains at least one instance of the OleDbError class.
The following example displays each OleDbError within the OleDbErrorCollection collection.
[ VB ]
Public Sub DisplayOleDbErrorCollection ( myException As OleDbException )
Dim i As Integer
For i = 0 To myException.Errors.Count - 1
Response.Write ( "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# ]
void DisplayOleDbErrorCollection ( OleDbException myException )
{
for ( int i=0; i < myException.Errors.Count; i++ )
{
Response.Write ( "Index #" + i + "<br>" +
"Message: " + myException.Errors [ ].Message + "<br>" +
"Native: " + myException.Errors [ ].NativeError.ToString ( ) + "<br>" +
"Source: " + myException.Errors [ ].Source + "<br>" +
"SQL: " + myException.Errors [ ].SQLState + "<br>" );
}
}
OleDbError OleDbException