Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionusing System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { private string rq_sql; private string cnx; private System.Data.OleDb.OleDbConnection oCNX; private System.Data.OleDb.OleDbCommand oCMD; private System.Data.OleDb.OleDbDataAdapter oDA; private System.Data.DataSet oDS; public Form1() { InitializeComponent(); } private void Form1_Load_1(object sender, EventArgs e) { this.rq_sql = null; /*change le chemin d'acces @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:Cocktail.accdb*/ this.cnx = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:Cocktail.accdb"; this.oCNX = new System.Data.OleDb.OleDbConnection(this.cnx); this.oCMD = null; this.oDA = null; } private void button1_Click(object sender, EventArgs e) { //ici on appuye sur un bouton pour que le tableau s'affiche grace a select qui se trouve plus bas this.select(); } private void select() { // voici la commande pour affiche ou selectionner ton tableau this.oDS = new DataSet(); // change la requete et mais ta requete si je me souviens bien c est // SELECT * FROM table1 this.rq_sql = "SELECT * FROM COCO;"; this.oCMD = new System.Data.OleDb.OleDbCommand(this.rq_sql, this.oCNX); this.oDA = new System.Data.OleDb.OleDbDataAdapter(this.oCMD); this.oDA.Fill(this.oDS, "rows"); // ici comme oDS a pris les valeur de la table on la mais mtn dans le dataGridView1. this.dataGridView1.DataSource = this.oDS; this.dataGridView1.DataMember = "rows"; }