idLocals
is Primary key in database
Populating the datatable
oDtLocalCharge = bll.GetData();
i am copying the datatable in another function
dtLocalCharges = oDtLocalCharge.Copy();
and trying to add rows using below code
DataRowCollection drr = oDtLocalCharge.Rows;
dtLocalCharges.Rows.Add(drr);
When i try to add rows to datatable, i am getting error as below
Error:
{System.ArgumentException: Unable to cast object of type 'System.Data.DataRowCollection' to type 'System.IConvertible'.Couldn't store <System.Data.DataRowCollection> in idLocals Column. Expected type is Int32. ---> System.InvalidCastException: Unable to cast object of type 'System.Data.DataRowCollection' to type 'System.IConvertible'.
May be Primary Key idLocals
is causing problem
what is the problem?
How can i fix this? I want to multiple add rows in dtLocalCharges
table