SqlCeParameterCollection.Contains Method (String)

Gets a value indicating whether a SqlCeParameter with the specified parameter name exists in the collection.

Namespace:  System.Data.SqlServerCe
Assembly:  System.Data.SqlServerCe (in System.Data.SqlServerCe.dll)

public override bool Contains(
	string value
)

Parameters

value
Type: System.String
The name of the parameter.

Return Value

Type: System.Boolean
true if the collection contains the parameter; otherwise, false.

Implements

IDataParameterCollection.Contains(String)

The following example searches for a SqlCeParameter with a given ParameterName within a SqlCeParameterCollection. 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 a SqlCeCommand has already been created.

// ...
// create SqlCeCommand cmd
// ...
if (!cmd.Parameters.Contains("Description"))
    MessageBox.Show("ERROR: no such parameter in the collection");
else
    MessageBox.Show("match on parameter #" +
        cmd.Parameters.IndexOf("Description").ToString());


Show: