where to write sqlparameters before/after sqlCommand CommandText
Which one is right?
Process1:
int id=2;
SqlCommand cmd= new SqlCommand();
cmd.CommandText= "select * from Customer where id= @id";
cmd.Parameters.Add(new SqlParameter("@id", id));
Process2:
int id=2;
SqlCommand cmd= new SqlCommand();
cmd.Parameters.Add(new SqlParameter("@id", id));
cmd.CommandText= "select * from Customer where id= @id";