共用方式為


SqlCeParameterCollection.Count Property

Gets the number of SqlCeParameter objects in the collection.

Namespace: System.Data.SqlServerCe
Assembly: System.Data.SqlServerCe (in system.data.sqlserverce.dll)

Syntax

'Declaration
Public Overrides ReadOnly Property Count As Integer
'Usage
Dim instance As SqlCeParameterCollection
Dim value As Integer

value = instance.Count
public override int Count { get; }
public:
virtual property int Count {
    int get () override;
}
/** @property */
public int get_Count ()
public override function get Count () : int
Not applicable.

Property Value

The number of SqlCeParameter objects in the collection.

Example

The following example adds SqlCeParameter objects to SqlCeParameterCollection, displays the names of the SqlCeParameter objects, and then clears the collection. This example assumes that a SqlCeCommand has already been created.

cmd.Parameters.Add("@ID", SqlDbType.Int)
cmd.Parameters.Add("@Description", SqlDbType.NVarChar)

Dim myParamList As String = ""
Dim i As Integer
For i = 0 To cmd.Parameters.Count
    myParamList &= "  " & cmd.Parameters(i).ParameterName & vbLf
Next i
MessageBox.Show("myChildren:" & vbLf & myParamList)

cmd.Parameters.Clear()
cmd.Parameters.Add("@ID", SqlDbType.Int);
cmd.Parameters.Add("@Description", SqlDbType.NVarChar);

string myParamList = "";
for (int i = 0; i < cmd.Parameters.Count; i++)
{
    myParamList += "  " + cmd.Parameters[i].ParameterName + "\n";
}
MessageBox.Show("myChildren:\n" + myParamList);

cmd.Parameters.Clear();

Platforms

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

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Version Information

.NET Framework

Supported in: 3.0

.NET Compact Framework

Supported in: 2.0, 1.0

See Also

Reference

SqlCeParameterCollection Class
SqlCeParameterCollection Members
System.Data.SqlServerCe Namespace