Spread the love
How to Update data in SQL server using visual C#
Following are few commands through which we can update data:-
con.Open();
string query = “update student set name='” + textBox2.Text + “‘,address='” + textBox3.Text + “‘,gender='” + comboBox1.Text + “‘,phone='” + textBox4.Text + “‘,age='” + textBox5.Text + “‘where id='” + textBox1.Text + “‘”;
SqlDataAdapter sda = new SqlDataAdapter(query, con);
sda.SelectCommand.ExecuteNonQuery();
con.Close();
MessageBox.Show(“Data updated successfully!!!!”);