DB2ErrorCollection.Item Property

Gets the error at the specified index.

Namespace:
IBM.Data.DB2
Assembly:
IBM.Data.DB2 (in IBM.Data.DB2.dll)

Syntax


[Visual Basic]
<Serializable>
Public Default ReadOnly Property Item( _
   ByVal i As Integer _
) As DB2Error

[C#]
[Serializable]
public DB2Error
 this[
   int i
] {get;}
[C++]
[Serializable]
public: __property DB2Error
* get_Item(
   int i
);
[JScript]
returnValue = DB2ErrorCollectionObject.Item(i);
-or-
returnValue = DB2ErrorCollectionObject(i);

Property value

A DB2®Error that contains the error at the specified index.

Remarks

The following example displays each DB2Error within the DB2ErrorCollection .

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