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";
Amit GuptaPosted Dec 13, 2017, 4:49 PM
Amit GuptaPosted Dec 14, 2017, 7:52 AM
darma tejaPosted Dec 14, 2017, 4:07 AM
Dharmraj ThakurPosted Dec 13, 2017, 11:57 PM
Nakul ChaudhariPosted Dec 13, 2017, 1:09 PM