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
    Get
'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;
}
abstract Count : int
override Count : int
override function get Count () : int

Property Value

Type: System.Int32
The number of SqlCeParameter objects in the collection.

Implements

ICollection.Count

Examples

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

See Also

Reference

SqlCeParameterCollection Class

System.Data.SqlServerCe Namespace