hi,
It happens when it is in a procedure is in loop if you are running this code block in a for loop against some array of values.
In that case, you would need to add the parameters collection to the
command object only once and before specifying the values for the
parameters.
This should be the right way.
SqlParameter myParam = new SqlParameter("@username",SqlDbType.VarChar);
myCommand.Parameters.Add(myParam);
foreach(string user in userNames)
{
myParam.Value = user;
myCommand.ExecuteNonQuery();
}
hope this will help you