Вот мой код:
Код: Выделить всё
protected void ButtonUpdate_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Data Source=ucpdapps2;Initial Catalog=Offline_CAD;Persist Security Info=True;User ID=sa;Password=Pro");
con.Open();
SqlCommand cmd = new SqlCommand("Update [Law_Responses] set (Calltaker,Date,City) Values (@Calltaker,@Date,@City where Textbox171.text = @ID)", con);
cmd.Parameters.AddWithValue("@Calltaker", DropDownList1.SelectedValue);
cmd.Parameters.AddWithValue("@Date", TextBox1.Text);
cmd.Parameters.AddWithValue("@City", DropDownList9.SelectedValue);
cmd.ExecuteNonQuery();
con.Close();
ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "alert('Incident Was Updated');", true);
}
Подробнее здесь: https://stackoverflow.com/questions/781 ... rver-table