bonjour à tous,

voila j'ai créer une table de données que j'ai connecter a mon projet winform en c# et je voudrai afficher une colonne de cette table dans une listboxdés l'uoverture de la fenetre pendant l'exécution. J'ai écrit sa, ms sa ne m'affiche rien :

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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public string connStr = "DRIVER={MySQL ODBC 5.1 Driver};SERVER=DBA-SRV;UID=user;DATABASE=base-fp;Password=****";
        public OdbcConnection oConn;
 
        public Form1()
        {
            oConn = new OdbcConnection(connStr);
 
            InitializeComponent();
 
            try
            {
                oConn.Open();
                Console.WriteLine("Successfully connected to the data base");
 
                OdbcCommand oComm = new OdbcCommand();
                oComm.Connection = oConn;
                oComm.CommandText = "Select * from Base-FP";
                OdbcDataReader oReader = oComm.ExecuteReader(CommandBehavior.CloseConnection);
                while (oReader.Read())
                {
                    lbAffichage.Items.Add(oReader[1].ToString());
                }
                Console.Read();
            }
            catch (OdbcException caught)
            {
                Console.WriteLine(caught.Message);
                Console.Read();
            }
            finally
            {
                oConn.Close();
                oConn = null;
            }
 
 
        }
 
        private void lbAffichage_SelectedIndexChanged(object sender, EventArgs e)
        {
 
        }
 
 
    }
}
merci d'avance