Click here to Skip to main content
15,886,045 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Dataset. Tables. Clear() and Datatable. Rows. Clear() Not clearing the data. Data appending every time. Please help me

What I have tried:

Ds = new dataset( table name)
Ds. Tables. Clear()
Ds. Reset()

Dt = new datatable(table name)
Dt. Rows. Clear()
Dt. Columns. Clear()
Dt. Reset()
Posted
Updated 30-Nov-21 19:54pm
Comments
Gireesh B 30-Nov-21 23:16pm    
Sql server compact and vs2010

1 solution

I suspect that that code isn't being executed, or isn't affecting the tables you think it is:
Dt = new datatable(table name)
Dt. Rows. Clear()
Dt. Columns. Clear()
Dt. Reset()

The last three lines are irrelevant, as the DataTable is already completely empty as it has been replaced with a brand new, empty DataTable which has no rows or columns.
It can have no data at all!

So start with the debugger and make sure it is executed. Then check that Dt isn't a local variable or a parameter to a method - because if it is, that won't affect the outside world at all.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900