how to delete single DataTable from DataSet?

  • Thread starter Thread starter Andre Ranieri
  • Start date Start date
A

Andre Ranieri

I've created a program that loops through the accounts
table in our
database, doing cleanup. Each time it finds an account
that needs
work, it fills a dataset temp table with the individual
services on
that account that need to be cleaned up. My DataSet has
two tables,
"AccountTable" that has the list of accounts that need be
cleaned up,
for each account in AccountTable, it invokes da.Fill
(ds, "TempTable")
to fill TempTable with a list of services that need be
modified for
that account.

The problem is that each time I fill TempTable, the
preceeding
account's services are still in the table. I'm want to run
ds.clear()
to clear the entire DataSet because I still need the
contents of
AccountTable, what's the syntax to just delete the
contents of just
one table in the DataSet?

Thanks,

Andre
 
If you want to remove the contents of the datatable but not actually remove
the table..

ds.Tables("TempTable").Clear

You can also use the numeric Index so if TempTable was the first table added
to the dataset

ds.Tables(0).Clear

On the other hand, if you want to remove the table from the Dataset...
ds.Tables("TempTable").Remove

or ds.Tables(0).Remove

Hope this helps.

Bill
 
Back
Top