Datatable clear

  • Thread starter Thread starter inadsad
  • Start date Start date
I

inadsad

Good day Group,
I have a form with a datagrid and two buttons. On show button
datagrid is populated with a datatable and on
clear button datagrid is cleared. DataTable.Clear not only removes
all of the data from the DataTable, it clears the dataset as well.
Why datatable.clear sets dataset to 0 rows?

Thanks
Ian
 
Ian,

Is the content of your dataset only one datatable, or more datatables which
in fact reference all to the same?

Cor
 
Thanks Cor for your respone.

It's one datatable as follows:

adapter.Fill(dataset1)
datatable1 = dataset1.Tables(0)
DataGridView1.DataSource = datatable1.DefaultView

Ian
 
Ian,

A dataset is just a wrapper around a datatable as it is only one.

The advantage is than only that you can easily serialize a datatable to a
XML file.

Cor
 
Back
Top