DataSet not Clearing

  • Thread starter Thread starter Dan
  • Start date Start date
D

Dan

I have a C# form with an OleDBconnection, adaptor and
dataset along with a several text boxes linked to the
Dataset and 2 buttons. I am assigning the dataset to a
DataGrid.

My problem:
I enter a date into a text box and use this as a variable
into a parameterized SQL statement. Click a button and
the SQL works great...populates Dataset and Grid.
Problem:
Now I enter a new date in the text field and click the
button to regenerate this SQL and it APPENDS the data to
the dataset and Datagrid. I would like this to be cleared
and only contain the results of the new query.

Thanks in advance - Dan
 
Dan said:
I have a C# form with an OleDBconnection, adaptor and
dataset along with a several text boxes linked to the
Dataset and 2 buttons. I am assigning the dataset to a
DataGrid.

My problem:
I enter a date into a text box and use this as a variable
into a parameterized SQL statement. Click a button and
the SQL works great...populates Dataset and Grid.
Problem:
Now I enter a new date in the text field and click the
button to regenerate this SQL and it APPENDS the data to
the dataset and Datagrid. I would like this to be cleared
and only contain the results of the new query.

Well, you could call DataSet.Clear() yourself just before doing the
query. That's probably the easiest way of doing things.
 
Back
Top