Tuesday, October 16, 2012

Datatable belongs to another dataset


DataTable already belongs to another DataSet this error we get when we are trying to add table into datatset which is already belonging to another dataset. So whats the solution?Its simpleUse Copy() method of DataTable to add to your dataset e.g.

objDataSet.Tables.Add( dataTableFromDataSetA.Copy() ); 

//here objDataSetis your Dataset and dataTableFromDataSetA is DataTable.


Hope this post save your time. Thank You.

No comments:

Post a Comment

Earn Money ! Affiliate Program
Open Directory Project at dmoz.org