We can clear all the text boxes in a form using foreach without typing codes for each text box to clear them.
com.Parameters.Add(new SqlParameter("@",objPlayrInjr_P));
using (SqlCommand com = new SqlCommand())
{
com.CommandText = "SPname";
com.Connection = connection object;
com.CommandType = CommandType.StoredProcedure;
com.Parameters.Add(new SqlParameter("@SqlParameterName",objectName.propertyName));
}
I need a method to add sqlParameters
to the Command
object through a loop, like how I did when clearing text boxes. So no need to write code for each and every statement, it will be done by the loop.