Cycle de progression Faire (quelque chose qui marche) -> comprendre ce que l’on fait/comment cela marche -> pousser plus loin les notions
| private void button2_Click(object sender, EventArgs e) { System.Data.DataTable oDataTable = new DataTable(); System.Data.OleDb.OleDbDataAdapter oOleDbDataAdapter = new System.Data.OleDb.OleDbDataAdapter(); oOleDbDataAdapter.SelectCommand = new System.Data.OleDb.OleDbCommand(); oOleDbDataAdapter.SelectCommand.Connection = new System.Data.OleDb.OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0; Data Source=C:Documents and SettingsromagnyMes documentsDIVERS.xlsx;Extended Properties=""Excel 12.0;HDR=YES;"""); oOleDbDataAdapter.SelectCommand.CommandType = CommandType.Text; oOleDbDataAdapter.SelectCommand.CommandText = "SELECT [ContactID],[ContactName],[ContactFirstName],[ContactEmail],[ContactCategoryID] FROM [Contact$]"; oOleDbDataAdapter.Fill(oDataTable); dataGridView1.DataSource = oDataTable; } |