DB2ParameterCollection.This (String) Property

Gets or sets the DB2Parameter with the specified name.

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

Syntax


[Visual Basic]
Overloads Public Default Property this( _
   ByVal parameterName As String _
) As DB2Parameter

[C#]
public DB2Parameter
 this[
   string parameterName
] {get; set;}
[C++]
public: __property DB2Parameter
* get_this(
   String* parameterName
);
public: __property void set_this(
   String* parameterName,
   DB2Parameter*
);
[JScript]
returnValue = DB2ParameterCollectionObject.this(parameterName);
DB2ParameterCollectionObject.this(parameterName) = returnValue;
-or-
returnValue = DB2ParameterCollectionObject(parameterName);
DB2ParameterCollectionObject(parameterName) = returnValue;

Property value

The DB2®Parameter with the specified name.

Exceptions

Exception type Condition
IndexOutOfRangeException The name specified does not exist.

Example

[Visual Basic, C#] The following example searches for a DB2Parameter with a given DB2Parameter.Name within a DB2ParameterCollection. If the parameter exists, the example displays the name and index of the parameter. If the parameter does not exist, the example displays an error. This example assumes that an DB2ParameterCollection has already been created.

[Visual Basic]
Public Sub SearchDB2Params()
    ' ...
    ' create DB2ParameterCollection myParameters
    ' ...
    If Not myParameters.Contains("Description") Then
        MessageBox.Show("ERROR: no such parameter in the collection")
    Else
        MessageBox.Show("Name: " & myParameters("Description").ToString() & _
                        "Index: " & myParameters.IndexOf("Description").ToString())
    End If
End Sub 'SearchDB2Params

[C#]
public void SearchDB2Params() {
    // ...
    // create DB2ParameterCollection myParameters
    // ...
    if (!myParameters.Contains("Description"))
       MessageBox.Show("ERROR: no such parameter in the collection");
    else
       MessageBox.Show("Name: " + myParameters["Description"].ToString() +
                 "Index: " + myParameters.IndexOf("Description").ToString());
 }