1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| try
{
connection.Open();
OleDbCommand command = new OleDbCommand();
command.Connection = connection;
command.CommandText ="Insert into AGENT(Matricule,Nom_Prénom,Date_naiss,Lieu_naiss,Age,Sexe,Situation_matrimon,Type_agent,Corps,Cadre,CATEGORIE,Grade,Echelon,Adresse,Personne_à_contacter) values('" + textBox1.Text + "','" + textBox2.Text + "','" + dateTimePicker1.Value + "','" + textBox8.Text + "','" + textBox5.Text + "','" + comboBox1.SelectedValue + "','" + comboBox2.SelectedValue + "','" + comboBox3.SelectedValue + "','" + textBox3.Text + "','" + textBox6.Text + "','" + comboBox4.SelectedValue + "','" + comboBox5.SelectedValue + "','" + comboBox6.SelectedValue + "','" + textBox4.Text + "','" + textBox7.Text + "');";
command.CommandText = "insert into SERVICE(Direction,Service,Fonction,Date affectation) values('" + textBox9.Text + "','" + textBox10.Text + "','" + textBox11.Text + "','" + textBox12.Text + "')";
command.ExecuteNonQuery();
MessageBox.Show("Data Saved");
connection.Close();
}
catch (Exception ex)
{
MessageBox.Show("Erreur" + ex);
}
} |
Partager