예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            itable++;
            string name  = textBox1.Text;
            string prix  = textBox2.Text;
            string reduc = textBox3.Text;

            SqlConnection connection = BDD.open();

            //insert une ligne dans la database
            string req = "INSERT INTO " + table + "(Id, " + col + ", prix, reduction) Values (" + Convert.ToString(itable) + ", '" + name + "', " + prix + ", " + reduc + ")";

            BDD.inserer(req, connection);
            connection.Close();

            this.Close();
        }
예제 #2
0
        private void button2_Click(object sender, EventArgs e)
        {//ajoute ou supprime des adresses mail
            string req;

            if (supp == 'n')
            {
                SqlConnection connection = BDD.open();
                //permet d'ajouter une @mail
                req = "INSERT INTO ADRESSES(adresse) values('" + textBox2.Text + "')";
                BDD.inserer(req, connection);
                connection.Close();
                textBox2.Text = "";
            }
            else
            {
                SqlConnection connection2 = BDD.open();
                //permet de supprimer une @mail
                req = "DELETE FROM ADRESSES WHERE adresse = '" + textBox2.Text + "'";
                BDD.delete(req, connection2);
                connection2.Close();
                textBox2.Text = "";
            }
        }