SqlCeParameterCollection.Add Method (String, SqlDbType)

Adds a SqlCeParameter to the SqlCeParameterCollection given the parameter name and data type.

Namespace:  System.Data.SqlServerCe
Assembly:  System.Data.SqlServerCe (in System.Data.SqlServerCe.dll)

public SqlCeParameter Add(
	string parameterName,
	SqlDbType type


Type: System.String
The name of the parameter.
Type: System.Data.SqlDbType
One of the SqlDbType values.

Return Value

Type: System.Data.SqlServerCe.SqlCeParameter
A reference to the new SqlCeParameter object.

The following example adds new element to a SqlCeParameterCollection. It assumes that a SqlCeCommand has already been created.

SqlCeParameter p1 = cmd.Parameters.Add("@Description", SqlDbType.NVarChar);
p1.Size = 16;
p1.Value = "Beverages";