DataGridView.DataSource = DataSet / DataTable puzzle

  • Thread starter Thread starter John Rivers
  • Start date Start date
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?
 
Back
Top