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.
 

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

Back
Top