0 down vote favorite I have a TextBox with id=txtPlace and a gridview. If a user selects a row an put some Information in the TextBox and click on save. The Information should replace older records in the database(SQL)
But It does not work. When I click on save, nothing happens.
protected void btnSave_Click(object sender, EventArgs e) { var id = GridView2.SelectedDataKey.Values[0].ToString(); string constr = ConfigurationManager.ConnectionStrings["con"].ConnectionString; using (SqlConnection conn = new SqlConnection(constr)) { string query = "UPDATE user SET place= @place where ID = @D "; SqlCommand cmd = new SqlCommand(query, conn); cmd.Parameters.AddWithValue("@place", txtPlace.Text); cmd.Parameters.AddWithValue("@ID", id); } }
cmd.ExecuteNonQuery();
conn.Open();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)