Sunday , 26 January 2020
Breaking News

How to Update data in sql server using visual C#

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!!!!”);

 

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Translate »