DB2ParameterCollection.this (Int32) Property
Gets or sets the DB2Parameter at the specified index.
- Namespace:
IBM.Data.DB2- Assembly:
IBM.Data.DB2(inIBM.Data.DB2.dll)
Syntax
[Visual Basic]
Overloads Public Default Property this( _
ByVal index As Integer _
) As DB2Parameter
[C#]
public DB2Parameter
this[
int index
] {get; set;}
[C++]
public: __property DB2Parameter
* get_this(
int index
);
public: __property void set_this(
int index,
DB2Parameter*
);
[JScript]
returnValue = DB2ParameterCollectionObject.this(index);
DB2ParameterCollectionObject.this(index) = returnValue;
-or-
returnValue = DB2ParameterCollectionObject(index);
DB2ParameterCollectionObject(index) = returnValue;
Property value
The DB2®Parameter at the specified index.
Exceptions
| Exception type | Condition |
|---|---|
| IndexOutOfRangeException | The index specified does not exist. |
Example
[Visual Basic, C#] The following example creates a DB2ParameterCollection , adds instances of DB2Parameter to the collection, displays the names of its DB2Parameter objects, and then clears the collection.
[Visual Basic]
Public Sub CreateDB2ParamColl(myCommand As DB2Command)
Dim myParamCollection As DB2ParameterCollection = myCommand.Parameters
myParamCollection.Add("EMPNO", DB2Type.Char)
myParamCollection.Add("PHOTO_FORMAT", DB2Type.VarChar)
myParamCollection.Add("PICTURE", DB2Type.Blob)
Dim myParamNames As String = ""
Dim i As Integer
For i = 0 To myParamCollection.Count - 1
myParamNames += myParamCollection(i).ToString() + ControlChars.Cr
Next i
MessageBox.Show(myParamNames)
myParamCollection.Clear()
End Sub 'CreateDB2ParamColl
[C#]
public void CreateDB2ParamColl(DB2Command myCommand) {
DB2ParameterCollection myParamCollection = myCommand.Parameters;
myParamCollection.Add("EMPNO", DB2Type.Char);
myParamCollection.Add("PHOTO_FORMAT", DB2Type.VarChar);
myParamCollection.Add("PICTURE", DB2Type.Blob);
string myParamNames = "";
for (int i=0; i < myParamCollection.Count; i++)
myParamNames += myParamCollection[i].ToString() + "\n";
MessageBox.Show(myParamNames);
myParamCollection.Clear();
}