Esempio n. 1
0
        private void Form9_Load(object sender, EventArgs e)
        {
            string req;

            SqlConnection connection = BDD.open();

            //permet d'afficher les nouveautes dans la listbox
            req = "SELECT salade FROM SALADES WHERE Id > 3";
            BDD.FillCLB(req, connection, checkedListBox1);
            connection.Close();

            SqlConnection connection2 = BDD.open();

            //permet d'afficher les nouveautes dans la listbox
            req = "SELECT burger FROM BURGERS WHERE Id > 3";
            BDD.FillCLB(req, connection2, checkedListBox1);
            connection2.Close();

            SqlConnection connection3 = BDD.open();

            //permet d'afficher les nouveautes dans la listbox
            req = "SELECT dessert FROM DESSERTS WHERE Id > 3";
            BDD.FillCLB(req, connection3, checkedListBox1);
            connection3.Close();

            SqlConnection connection4 = BDD.open();

            //permet de recuperer les produits en promotion
            req = "SELECT burger, reduction FROM BURGERS WHERE reduction != 0";
            BDD.FillCLB2(req, connection4, checkedListBox2);
            connection4.Close();

            SqlConnection connection5 = BDD.open();

            //permet de recuperer les produits en promotion
            req = "SELECT salade, reduction FROM SALADES WHERE reduction != 0";
            BDD.FillCLB2(req, connection5, checkedListBox2);
            connection5.Close();


            SqlConnection connection6 = BDD.open();

            //permet de recuperer les produits en promotion
            req = "SELECT dessert, reduction FROM DESSERTS WHERE reduction != 0";
            BDD.FillCLB2(req, connection6, checkedListBox2);
            connection6.Close();

            //coche tous les items de la checkedlistbox2 (compte les elements et les coche un a un)
            int f = checkedListBox2.Items.Count;
            int g = 0;

            while (g < f)
            {
                checkedListBox2.SetItemCheckState(g, CheckState.Checked);
                g++;
            }
        }