Thursday , 1 October 2020
Breaking News

How to Update data in SQL server using visual C#


Notice: Undefined index: tie_hide_meta in /home1/adnanonl/public_html/wp-content/themes/sahifa/framework/parts/meta-post.php on line 3

Notice: Trying to access array offset on value of type null in /home1/adnanonl/public_html/wp-content/themes/sahifa/framework/parts/meta-post.php on line 3
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!!!!”);

 

 

Leave a Reply

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