Trying to Remove All Rows in All Tables in Dataset Through Code

Here is the situation. I am working in a Custom Code Function. I have a dataset for Project called projTS. I want to find the easiest way to clear out all the rows of all the tables so that my dataset is just the structure and no data. Would any of the below do what I want?

projTS.Tables.Clear();

projTS.Tables.Remove();

projTS.Tables.RemoveAll();

If anyone knows if any of the above or possibly another way works, it will be greatly appreciated.

Hi John,

Would something like the below work?

tsProject = new ProjectTableSet();

Thanks,

Nathan

1 Like

Smart thinking. I’ll give it a go.

If that doesn’t work, try this: projTS.Clear();

ProjectTS = new Erp.Tablesets.ProjectTableset();

OR

foreach(var table in ProjectTS.Tables)
   table.Clear();
4 Likes

Yeah John, just make a new tableset.

2 Likes