1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
if (numberAgent.Text != "" && passwordAgent.Text != "" && matriculeAgent.Text != "")
{
string requete = "INSERT INTO Users(nom,password,matricule) VALUES ('" + numberAgent.Text + "','" + passwordAgent.Text + "','" + matriculeAgent.Text + "');";
OleDbConnection conn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0 ; Data Source=Recherche.mdb;Jet OLEDB:Database password=osstarSOS ;");
try
{
OleDbCommand command = new OleDbCommand(requete,conn);
conn.Open();
command.ExecuteNonQuery();
numberAgent.Clear();
passwordAgent.Clear();
matriculeAgent.Clear();
System.Windows.Forms.MessageBox.Show("agent inséré");
}
catch (OleDbException ex)
{
MessageBox.Show(ex.Message);
}
finally
{
conn.Close();
}
}
else
{
MessageBox.Show("Remplir les champs");
} |
Partager