Export (0) Print
Expand All

SqlCeParameterCollection.Contains Method (Object)

Gets a value indicating whether or not a SqlCeParameter object exists in the collection.

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

public override bool Contains(
	Object value
)

Parameters

value
Type: System.Object
The value of the SqlCeParameter object to find.

Return Value

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

Implements

IList.Contains(Object)

The following example searches for a SqlCeParameter 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
// ...
SqlCeParameter myParam = cmd.Parameters.Add("@Description", SqlDbType.NVarChar);
if (!cmd.Parameters.Contains(myParam))
    MessageBox.Show("ERROR: no such parameter in the collection");
else
    MessageBox.Show("match on parameter #" +
        cmd.Parameters.IndexOf(myParam).ToString());


Show:
© 2014 Microsoft