DB2Exception.Errors Property
Gets a collection of one or more DB2Error objects that give detailed information about exceptions generated by the IBM® Data Server Provider for .NET.
- Namespace:
IBM.Data.DB2
- Assembly:
IBM.Data.DB2
(inIBM.Data.DB2.dll
)
Syntax
[Visual Basic]
<Serializable>
Public ReadOnly Property Errors As DB2ErrorCollection
[C#]
[Serializable]
public DB2ErrorCollection
Errors {get;}
[C++]
[Serializable]
public: __property DB2ErrorCollection
* get_Errors();
[JScript]
public
Serializable
function get Errors() : DB2ErrorCollection
;
Property value
The collected instances of the DB2®Error class.
Remarks
This property is a wrapper for the DB2ErrorCollection .
Example
[Visual Basic, C#] The following example displays each DB2Error within a DB2ErrorCollection collection.
[Visual Basic]
Public Sub DisplayDB2ErrorCollection(myException As DB2Exception)
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 DisplayDB2ErrorCollection(DB2Exception 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");
}
}