asp.net.ph

OleDbError Class

System.Data.OleDb Namespace


Collects information relevant to a warning or error returned by the data source.

OleDbError Class Members

Collapse   Properties

Visibility Name Value Type Accessibility
public Message String [ Get ]
public NativeError Int32 [ Get ]
public Source String [ Get ]
public SQLState String [ Get ]

Collapse   Methods

Visibility Name Parameters Return Type
public ToString ( ) String

Remarks

This class is created by the OleDb data adapter when an error occurs. An instance of OleDbError is created and managed by the OleDbErrorCollection class, which in turn is created by the OleDbException class.

If the severity of the error is too great, the server may close the OleDbConnection. However, the user can reopen the connection and continue.

Example

The following example displays the properties of the OleDbError.


[ 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>" );
   }
}
See Also

OleDbErrorCollection   OleDbException Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph