The SqlParameterCollection
has an Add(SqlParameter)
method, and AddRange(SqlParameter[])
method. Each has several overloads.
Specifically, SqlCommand.Parameters
is read only, and if I have a SqlParameterCollection
I can't just assign it, so I want to add it onto the existing collection.
Right now there's a loop in my code:
SqlCommand cmd = new SqlCommand();
foreach (SqlParameter param in collection)
{
cmd.Parameters.Add(param);
}
Is there an easy built-in way to add a SqlParameterCollection
to another?