private void button1_Click(object sender, EventArgs e) { connection.Open(); SqlCommand cmd = connection.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "update Angajat set Salariu='" + textBox2.Text + "', ID_Sed='" + textBox3.Text + "' where Nume='" + textBox1.Text + "'"; cmd.ExecuteNonQuery(); connection.Close(); form1.display_data_ang(); MessageBox.Show("Angajatul a fost actualizat."); }
private void button1_Click(object sender, EventArgs e) { connection.Open(); SqlCommand cmd = connection.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "delete from Angajat where CNP='" + textBox1.Text + "'"; cmd.ExecuteNonQuery(); connection.Close(); form1.display_data_ang(); MessageBox.Show("Angajatul a fost sters."); }
private void button1_Click(object sender, EventArgs e) { connection.Open(); SqlCommand cmd = connection.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "insert into Angajat values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "')"; cmd.ExecuteNonQuery(); connection.Close(); form1.display_data_ang(); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; textBox5.Text = ""; MessageBox.Show("Angajatul a fost adaugat."); }