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
public boolean Contains (
    String value
)
public override function Contains (
    value : String
) : boolean

Parameters

  • value
    The name of the parameter.

Return Value

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

Example

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());

.NET Framework Security

  • Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see .

Platforms

Windows CE, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows XP Professional x64 Edition, Windows XP SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

Version Information

.NET Compact Framework

Supported in: 2.0, 1.0

See Also

Reference

SqlCeParameterCollection Class
SqlCeParameterCollection Members
System.Data.SqlServerCe Namespace