private void button3_Click(object sender, EventArgs e) { string sa = textBox1.Text.Trim(); try { string connetionString = null; connetionString = "Data Source=JDPANDEY-PC;Initial Catalog=amsco;User ID = sa;Password= 123"; cnn = new SqlConnection(connetionString); cnn.Open(); ds = new DataSet(); string sql = "select * from employee"; da = new SqlDataAdapter(sql, cnn); da.Fill(ds, "employee"); int r = 0; DataRow[] rs; rs = ds.Tables["employee"].Select("eid='" + textBox1.Text.Trim() + "'"); r = rs.Length; if (r > 0) { string str = "UPDATE employee set ename='" + textBox2.Text.Trim() + "',fname='" + textBox3.Text.Trim() + "' WHERE eid ='" + textBox1.Text.Trim() + "'"; cmd = new SqlCommand(str, cnn); cmd.ExecuteNonQuery(); MessageBox.Show("Record UPDATED"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } cnn.Close(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)