Data Grid View And Database

  • Thread starter Rodrigo Ferreira
  • Start date
R

Rodrigo Ferreira

Hello i have some problems with load values to a datagridview.

I can´t put the data from a database into a datagridview.

My code is:

Base.bd bd1 = new Base.bd();

OleDbCommand c1 = new OleDbCommand("SELECT * FROM table1");

c1.Connection = bd1.getConn();

DataSet ds = new DataSet();

OleDbDataAdapter da = new OleDbDataAdapter();

da.SelectCommand = c1;

da.Fill(ds);

dgvModulos.AutoGenerateColumns = false;

dgvModulos.DataSource = ds;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top