Hi

i have a dataset already created (which may consist of many tables)

now i would liek to fill the datagrid view from it. BY CODE

how can i do so?

You can bind it (this is the best solution and th fastest).

dataGridView1.DataSource = new BindingSource(myDataSet.Tables["tableName"], null);

Thats it!
And the data will appear in the DGV.

You can bind it (this is the best solution and th fastest).

dataGridView1.DataSource = new BindingSource(myDataSet.Tables["tableName"], null);

Thats it!
And the data will appear in the DGV.

I did that but only the column headers are displaying

That means that your DataTable is empty. You didnt get any data out of the dataBase. Check the sql query.

i resolved it thx

what was is? It was yout sql query? Was not ok before?

what was is? It was yout sql query? Was not ok before?

yes because i had some data entered which did not enter properly maybe because i had some bugs in my application

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.