System.Data.SqlClient Namespace
Collects all errors thrown by the SqlDataAdapter.
This class is created by SqlException to collect instances of the SqlError class. SqlErrorCollection always contains at least one instance of the SqlError class.
The following example displays each SqlError within the SqlErrorCollection.
public void DisplaySqlErrors ( SqlException myException ) {
for ( int i=0; i < myException.Errors.Count; i++ ) {
Response.Write ( "Index #" + i + "<br>" +
"Error: " + myException.Errors [ ].ToString ( ) + "<br>" );
}
}
Public Sub DisplaySqlErrors ( myException As SqlException )
Dim i As Integer
For i = 0 To myException.Errors.Count - 1
Response.Write ( "Index #" & i & ControlChars.Cr & _
"Error: " & myException.Errors ( i ).ToString ( ) & ControlChars.Cr )
Next i
End Sub |
|
C# |
VB |
SqlError SqlException