Hi,

I populate a dataset and then bind a grid to the dataset. The application
allows the user
to repopulate the dataset to show different data in the application.

The problem seems to be that the dataset, keeps the old dataset, as the grid
then displayes multiple datasets, even though I am using the new keyword

Is there a way to totally destroy the contents of the dataset each time I
repopulate it?

My code is :


Dim command2 As New OleDbCommand("select * from WorkSheet_CostDetail
where sheet=" & intWorkSheet, dbConnection)

Dim ds As New DataSet
Dim da2 As New OleDbDataAdapter(command2)

da2.Fill(ds, "ProjectCosts")

FpSpread1.DataSource = ds

Re: how to empty a dataset/dataadapter by Cor

Cor
Thu Mar 13 23:24:25 CDT 2008

Aussie

As you create a new dataset, you have to set it again as datasource to the
control.
The old dataset stays as long as there is a reference to it from that
DataGrid.

If you don't use the new dataset, then you can clear the dataset. Simple
enough YourDataset.Clear

Cor

"Aussie Rules" <aussie@nospam.com> schreef in bericht
news:%235lMEWYhIHA.1408@TK2MSFTNGP03.phx.gbl...
> Hi,
>
> I populate a dataset and then bind a grid to the dataset. The application
> allows the user
> to repopulate the dataset to show different data in the application.
>
> The problem seems to be that the dataset, keeps the old dataset, as the
> grid then displayes multiple datasets, even though I am using the new
> keyword
>
> Is there a way to totally destroy the contents of the dataset each time I
> repopulate it?
>
> My code is :
>
>
> Dim command2 As New OleDbCommand("select * from
> WorkSheet_CostDetail where sheet=" & intWorkSheet, dbConnection)
>
> Dim ds As New DataSet
> Dim da2 As New OleDbDataAdapter(command2)
>
> da2.Fill(ds, "ProjectCosts")
>
> FpSpread1.DataSource = ds
>
>