Thursday, 26 July 2012

DataTable already belongs to another DataSet error.

DataTable already belongs to another DataSet error.
and
This row already belongs to another table


both error are same because in both case you can not assign or add your row or table to another datatable or dataset.
because it already belongs to another.
so solution is use importrow method to add row in datatable.
or
use copy method to add datatble in dataset
 mytable.ImportRow(dr);   
or
 DataTable copyDataTable;  
   copyDataTable = myDataTable.Copy();  

No comments:

Post a Comment