i can't update data with tihs Code. So can Anyone suggest me as soon as possible.
- string CN = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
- using (SqlConnection cn = new SqlConnection(CN))
- {
- cn.Open();
- string s = "update Users set Username=@Username,Email=@Email,Password =@Password,City =@City,ContactNo =@ContactNo where ( Id =@Id)";
- SqlCommand cmd = new SqlCommand(s, cn);
- cmd.Parameters.AddWithValue("@Username", textbox1.Text);
- cmd.Parameters.AddWithValue("@Email", textbox2.Text);
- cmd.Parameters.AddWithValue("@Password", textbox3.Text);
- cmd.Parameters.AddWithValue("@City", textbox4.Text);
- cmd.Parameters.AddWithValue("@ContactNo", textbox5.Text);
- cmd.Parameters.AddWithValue("@Id", textbox6.Text);
- cmd.ExecuteNonQuery();
- Response.Write("Your data SuccessFully Updated");