remplir un datagridview de la base
bonjour tous le monde
j'essaye d'afficher une sélection de la base de données dans un datagridview
mais rien ne s'affiche
voici le code
Code:
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
| string strRequete = "SELECT MATRICULE_EMP,matricule1,NOM,PRENOM,DATE_ACC,DATE_REPRISE,NBR_JOUR_REPOS FROM EMPLOYE,ACCIDENT WHERE accident.matricule1= employe.matricule_emp and DATE_ACC>='" + date_debut.Text + "' AND DATE_REPRISE<= '" + date_fin.Text + "'ORDER BY DATE_ACC DESC";
OracleCommand oCommand = new OracleCommand(strRequete, oConnection);
OracleDataReader oReader = oCommand.ExecuteReader();
OracleDataAdapter dataAdapter = new OracleDataAdapter(strRequete, strConnexion);
//OracleCommandBuilder commandBuilder = new OracleCommandBuilder(dataAdapter);
DataTable table = new DataTable();
try
{
dataAdapter.Fill(table);
}
catch(Exception ex)
{
MessageBox.Show("Erreur d'extraction des données", "Lecture des données");
}
//dataGridView1.DataSource =table;
//dataGridView1.Columns[0].HeaderText = "Matricule";
//dataGridView1.Columns[0].Width = 70;
//dataGridView1.Columns[1].HeaderText = "Nom";
//dataGridView1.Columns[1].Width = 100;
//dataGridView1.Columns[2].HeaderText = "Prénom";
//dataGridView1.Columns[2].Width = 100;
//dataGridView1.Columns[3].HeaderText = "Date Accident";
//dataGridView1.Columns[3].Width = 120;
//dataGridView1.Columns[4].HeaderText = "Date Retour";
//dataGridView1.Columns[4].Width = 120;
//dataGridView1.Columns[5].HeaderText = "Durée Repos (jours)";
//dataGridView1.Columns[5].Width = 60; |
je ne sais pas ou est le problème!!!!!