.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!



Home >> Code Snippets >> ADO.NET >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

DataTable already belongs to another DataSet

Posted By:Pankaj Mishra       Posted Date: August 11, 2008    Points: 10    Category: ADO.NET    URL: http://www.dotnetspark.com  
 

DataTable already belongs to another DataSet this error we get when we are tring to add table into datatset which is already belonging to another table. So whats the solution?

Its simple

Use Copy() method of DataTable to add to your DataSet eg.

yourDataSet.Tables.Add(yourDataTable.Copy()); //here yourDataSet is your Dataset and yourDataTable is DataTable.

Cheers
Pankaj


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend