SqlCeParameterCollection.Contains 方法 (String)

获取一个值,该值指示集合中是否存在一个具有指定参数名的 SqlCeParameter

命名空间: System.Data.SqlServerCe
程序集: System.Data.SqlServerCe(在 system.data.sqlserverce.dll 中)

语法

声明
Public Overrides Function Contains ( _
    value As String _
) As Boolean
用法
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
不适用。

参数

  • value
    参数名。

返回值

如果集合包含该参数,则为 true;否则为 false

示例

下面的示例在 SqlCeParameterCollection 中搜索具有给定 ParameterNameSqlCeParameter。如果该参数存在,则该示例显示参数的索引。如果该参数不存在,则该示例显示一个错误。此示例假定已经创建了 SqlCeCommand

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

平台

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

Windows Vista、Microsoft Windows XP SP2 和 Windows Server 2003 SP1 支持 Microsoft .NET Framework 3.0。

版本信息

.NET Framework

受以下版本支持:3.0

.NET Compact Framework

受以下版本支持:2.0、1.0

请参见

参考

SqlCeParameterCollection 类
SqlCeParameterCollection 成员
System.Data.SqlServerCe 命名空间