private void button_annuler_MouseClick(object sender, MouseEventArgs e)
        {
            RechercheAcheteur ra = new RechercheAcheteur();

            ra.Show(this);
            this.Hide();
        }
Exemplo n.º 2
0
        private void fermer_Click(object sender, EventArgs e)
        {
            RechercheAcheteur ra = new RechercheAcheteur();

            ra.Show(this);
            this.Hide();
        }
        private void button_valider_MouseClick(object sender, MouseEventArgs e)
        {
            string          ChaineBd     = "Provider=SQLOLEDB;Data Source=INFO-joyeux;Initial Catalog=IMMOBILLY_JACKYTEAM;Persist Security Info=True; Integrated Security=sspi;";
            OleDbConnection dbConnection = new OleDbConnection(ChaineBd);

            dbConnection.Open();
            string sql1 = "INSERT into Acheteur(Nom_Acheteur, PRÉNOM_ACHETEUR, Adresse, TÉLÉPHONE, E_MAIL, CODE_VILLE, NUM_COMMERCIAL)";
            string sql2 = "VALUES('" + textBox_Nom.Text.Replace("'", "''") + "','" + textBox_Prénom.Text.Replace("'", "''") + "','" + textBox_Adresse.Text.Replace("'", "''") + "','" + textBox_tel.Text + "','" + textBox_email.Text + "' , (SELECT v.code_ville from VILLE v where v.NOM_VILLE like  '" + textBox1.Text + "' and v.CODE_POSTAL like '" + textBox_CP.Text + "'),(select c.NUM_COMMERCIAL from COMMERCIAL c where NOM LIKE '" + comboBox_commercial.Text.Replace("'", "''") + "' ) )";

            string sql = sql1 + sql2;


            OleDbCommand cmd = new OleDbCommand(sql, dbConnection);

            cmd.ExecuteNonQuery();
            MessageBox.Show("Saved");
            RechercheAcheteur ra = new RechercheAcheteur();

            ra.Show(this);
            this.Hide();
        }