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)

public override int Count { get; }

Property Value

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



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

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