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)

Syntax

'Declaration
Public Overrides Function Contains ( _
    value As String _
) As Boolean
'Usage
Dim instance As SqlCeParameterCollection
Dim value As String
Dim returnValue As Boolean

returnValue = instance.Contains(value)
public override bool Contains(
    string value
)
public:
virtual bool Contains(
    String^ value
) override
abstract Contains : 
        value:string -> bool 
override Contains : 
        value:string -> bool 
public override function Contains(
    value : String
) : boolean

Parameters

Return Value

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

Implements

IDataParameterCollection.Contains(String)

Examples

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 Not cmd.Parameters.Contains("Description") Then
    MessageBox.Show("ERROR: no such parameter in the collection")
Else
    MessageBox.Show("match on parameter #" & cmd.Parameters.IndexOf("Description").ToString())
End If
// ...
// 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());

See Also

Reference

SqlCeParameterCollection Class

Contains Overload

System.Data.SqlServerCe Namespace