Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
After adding a datatable to a dataset, can i disconnect that datatable from dataset?
Posted
Updated 5-Oct-17 20:43pm

The best bet would be to try this out yourself.
Use the Fill method to fill a dataset with a datatable and then clear the datatable and see what happens.
 
Share this answer
 
v2
 
Share this answer
 
Hi, try this
C#
DatasetName.Tables.Remove(DataTableName);
 
Share this answer
 
Without looking at code, it's difficult to provide exact solution.

I searched exact text of your Question on Google and no wonder found so many links.

Google Search[^]
 
Share this answer
 
 
Share this answer
 
try :

Datasetname.Tables.clear()
 
Share this answer
 
if you know the index value of table
dst.Tables.RemoveAt()

if you know the table name then
dst.Tables.Remove("TableName")
 
Share this answer
 
use table.copy() method

It will work :)
 
Share this answer
 
Comments
Richard MacCutchan 20-Feb-14 12:45pm    
This question is more than two years old. Please don't do this.
Shailesh g 9-Dec-14 2:16am    
table.copy() is the best way to get rid of this. This is not compulsory that same datatable is beeing used. Sometimes it happens when we modify the same datatable and same we are trying to add in any dataset.
//add not scanned data into dataset
DataSet ds = new DataSet();
dtdetails.TableName = "Table1";
dtnotscanDetails.TableName = "Table2";
ds.Tables.AddRange(new DataTable[] {dtdetails.Copy(),dtnotscanDetails.Copy() });
 
Share this answer
 
Comments
CHill60 20-May-14 6:40am    
Doesn't add anything to other solutions added much earlier - post is nearly 3 years old!

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