Export (0) Print
Expand All

OracleParameterCollection.IndexOf Method

Note: This namespace, class, or member is supported only in version 1.1 of the .NET Framework.

Gets the location in the collection of the OracleParameter object.

Overload List

Gets the location in the collection of the OracleParameter object with the specified value.

[Visual Basic] Overloads Public Overridable Function IndexOf(Object) As Integer Implements IList.IndexOf
[C#] public virtual int IndexOf(object);
[C++] public: virtual int IndexOf(Object*);
[JScript] public function IndexOf(Object) : int;

Gets the location in the collection of the OracleParameter object with the specified parameter name.

[Visual Basic] Overloads Public Overridable Function IndexOf(String) As Integer Implements IDataParameterCollection.IndexOf
[C#] public virtual int IndexOf(string);
[C++] public: virtual int IndexOf(String*);
[JScript] public function IndexOf(String) : int;

Example

[Visual Basic, C#, C++] The following example searches for an OracleParameter object in an OracleParameterCollection. If the parameter exists, the example displays the index of the parameter. If the parameter does not exist, the example displays an error. This example assumes that an OracleParameterCollection has already been created.

[Visual Basic, C#, C++] Note   This example shows how to use one of the overloaded versions of IndexOf. For other examples that might be available, see the individual overload topics.
[Visual Basic] 
Public Sub SearchOracleParams()
    ' ...
    ' create OracleParameterCollection myParameters and OracleParameter myNewParam
    ' ...
    If Not myParameters.Contains(myNewParam) Then
        MessageBox.Show("ERROR: no such parameter in the collection")
    Else
        MessageBox.Show("match on parameter #" & myParameters.IndexOf(myNewParam).ToString())
    End If
End Sub 'SearchOracleParams

[C#] 
public void SearchOracleParams() {
    // ...
    // create OracleParameterCollection myParameters and OracleParameter myNewParam
    // ...
    if (!myParameters.Contains(myNewParam))
       MessageBox.Show("ERROR: no such parameter in the collection");
    else
       MessageBox.Show("match on parameter #" +
                 myParameters.IndexOf(myNewParam).ToString());
}

[C++] 
public:
void SearchOracleParams() {
    // ...
    // create OracleParameterCollection myParameters and OracleParameter myNewParam
    // ...
    if (!myParameters->Contains(myNewParam))
       MessageBox::Show(S"ERROR: no such parameter in the collection");
    else
       MessageBox::Show(String::Format( S"match on parameter #{0}", __box(myParameters->IndexOf(myNewParam))));
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

OracleParameterCollection Class | OracleParameterCollection Members | System.Data.OracleClient Namespace

Show:
© 2014 Microsoft