Bonjour à tous,

J'arrive à récupérer le résultat de mon calcul dans une boucle mais ensuite je sèche complètement pour afficher ce résultat dans ma colonne pourcentage

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
30
31
32
 
        public StatPatient()
        {
            InitializeComponent();
            Afficher();
            test();
        }
 
        private void Afficher()
        {
            GestionListe.RemplirListe(Program.BD, listStatP, "SELECT patient.id, COUNT(*) AS Nombre_de_patients, provenance.nom_provenance AS Provenance FROM patient LEFT JOIN provenance ON patient.ref_provenance = provenance.id GROUP BY provenance.id");
            listStatP.Columns.Add("Pourcentage", 80);
        }
 
        private void test() 
        {
            double nbrPT = Program.BD.GetValueDouble("SELECT COUNT(*) FROM patient");
            double nbrEnregistrements = Program.BD.GetValueDouble("SELECT COUNT(*) FROM (SELECT COUNT(*) FROM patient LEFT JOIN provenance ON patient.ref_provenance = provenance.id GROUP BY provenance.id)AS COUNTS");
            double nombre = 0;
            double calcul = 0;
            double position = nbrEnregistrements - 1;
            for (double i = 0; i <= position; i++) 
            {
                nombre = Program.BD.GetValueDouble("SELECT COUNT(*) FROM patient LEFT JOIN provenance ON patient.ref_provenance = provenance.id GROUP BY provenance.id LIMIT "+i+",1");               
                calcul = (nombre / nbrPT) * 100;
                textBox1.Text += calcul.ToString() + "%\r\t";
            }
 
            //string[] texte = textBox1.Text.Split('\t');
            //string pourcentage = texte[0] + "-" + texte[1] + "-" + texte[2];
            //MessageBox.Show('"'+ pourcentage +'"');
        }
Merci d'avance