1string name = "test1";
2int id = 1;
3using (SqlConnection cnn = new SqlConnection("Server=localhost;Database=DEV;User Id=test;Password=test!@#$;Connect Timeout=5400"))
4{
5 cnn.Open();
6 string querystr = "UPDATE [dbo].[TABLE] SET [name]=@p_name WHERE [id]=@p_id";
7 using (var cmd = new SqlCommand(querystr, cnn))
8 {
9 //set value
10 cmd.Parameters.AddWithValue("@p_name", name);
11 //where with id
12 cmd.Parameters.AddWithValue("@p_id", id);
13 int ret = cmd.ExecuteNonQuery();
14 }
15}