DataGridView.DataSource = DataSet / DataTable puzzle

J

John Rivers

Hi

I create a DataGridView
and then populate a DataSet (using a SqlDataAdapter)

THEN call DataSet.Reset() and repopulate the DataSet with a completely
different SQL statement

if I do this:

grid.DataSource = set;
grid.DataMember = set.Tables[0].TableName;

the DataGridView reverts back to the Columns from the previous data

but if I do this:

grid.DataSource = set.Tables[0];

then the DataGridView successfully updates both columns and records

I have done many tests to determine where the schema / columns are
getting cached
but cannot solve this puzzle ...

any ideas?
 

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