Bewerken

Delen via


OdbcParameterCollection.Contains Method

Definition

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

Overloads

Contains(OdbcParameter)

Determines whether the specified OdbcParameter is in this OdbcParameterCollection.

Contains(Object)

Determines whether the specified Object is in this OdbcParameterCollection.

Contains(String)

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

Contains(OdbcParameter)

Source:
OdbcParameterCollection.cs
Source:
OdbcParameterCollection.cs
Source:
OdbcParameterCollection.cs

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

value
OdbcParameter

The OdbcParameter value.

Returns

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

See also

Applies to

Contains(Object)

Source:
OdbcParameterCollectionHelper.cs
Source:
OdbcParameterCollectionHelper.cs
Source:
OdbcParameterCollectionHelper.cs

Determines whether the specified Object is in this OdbcParameterCollection.

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

Parameters

value
Object

The Object value.

Returns

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

Implements

See also

Applies to

Contains(String)

Source:
OdbcParameterCollection.cs
Source:
OdbcParameterCollection.cs
Source:
OdbcParameterCollection.cs

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:
 virtual bool Contains(System::String ^ value);
public override bool Contains (string value);
public bool Contains (string value);
override this.Contains : string -> bool
abstract member Contains : string -> bool
override this.Contains : string -> bool
Public Overrides Function Contains (value As String) As Boolean
Public Function Contains (value As String) As Boolean

Parameters

value
String

The name of the OdbcParameter object to find.

Returns

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

Implements

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