OdbcParameterCollection.Contains OdbcParameterCollection.Contains OdbcParameterCollection.Contains OdbcParameterCollection.Contains Method

Definition

Gets a value indicating whether an OdbcParameter object exists in the collection.

Overloads

Contains(OdbcParameter) Contains(OdbcParameter) Contains(OdbcParameter) Contains(OdbcParameter)

Determines whether the specified OdbcParameter is in this OdbcParameterCollection.

Contains(Object) Contains(Object) Contains(Object) Contains(Object)

Determines whether the specified Object is in this OdbcParameterCollection.

Contains(String) Contains(String) Contains(String) Contains(String)

Gets a value indicating whether an OdbcParameter object with the specified parameter name exists in the collection.

Contains(OdbcParameter) Contains(OdbcParameter) Contains(OdbcParameter) Contains(OdbcParameter)

Determines whether the specified OdbcParameter is in this OdbcParameterCollection.

public:
 bool Contains(System::Data::Odbc::OdbcParameter ^ value);
public bool Contains (System.Data.Odbc.OdbcParameter value);
override this.Contains : System.Data.Odbc.OdbcParameter -> bool
Public Function Contains (value As OdbcParameter) As Boolean

Parameters

Returns

true if the OdbcParameter is in the collection; otherwise, false.

See also

Contains(Object) Contains(Object) Contains(Object) Contains(Object)

Determines whether the specified Object is in this OdbcParameterCollection.

public:
 override bool Contains(System::Object ^ value);
public override bool Contains (object value);
override this.Contains : obj -> bool
Public Overrides Function Contains (value As Object) As Boolean

Parameters

value
Object Object Object Object

The Object value.

Returns

true if the OdbcParameterCollection contains the value; otherwise, false.

See also

Contains(String) Contains(String) Contains(String) Contains(String)

Gets a value indicating whether an OdbcParameter object with the specified parameter name exists in the collection.

public:
 override bool Contains(System::String ^ value);
public override bool Contains (string value);
override this.Contains : string -> bool
Public Overrides Function Contains (value As String) As Boolean

Parameters

value
String String String String

The name of the OdbcParameter object to find.

Returns

true if the collection contains the parameter; otherwise, false.

Examples

The following example searches for an OdbcParameter with a given ParameterName within an OdbcParameterCollection. 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 OdbcParameterCollection has already been created.

public void SearchParameters() 
{
    // ...
    // create OdbcParameterCollection parameterCollection
    // ...
    if (!parameterCollection.Contains("Description"))
        Console.WriteLine("ERROR: no such parameter in the collection");
    else
        Console.WriteLine("Name: " + parameterCollection["Description"].ToString() +
            "Index: " + parameterCollection.IndexOf("Description").ToString());
}
Public Sub SearchParameters()
    ' ...
    ' create OdbcParameterCollection parameterCollection
    ' ...
    If Not parameterCollection.Contains("Description") Then
        Console.WriteLine("ERROR: no such parameter in the collection")
    Else
        Console.WriteLine("Name: " & parameterCollection("Description").ToString() & _
            "Index: " & parameterCollection.IndexOf("Description").ToString())
    End If
End Sub 
See also

Applies to