B
Bishman
Hi,
I am using a Queue object to save the contents of a DataSet within a
'foreach' loop.
I use the .Enqueue method to add the Row to the Queue, but when the .Delete
method is called on the original row each 'field' value has the exception
'dr.ItemArray' threw an exception of type
'System.Data.DeletedRowInaccessibleException'
The code:
casc_WALLBOARDTableAdapter.Fill(insightDataSet.CASC_WALLBOARD);
foreach (InsightDataSet.CASC_WALLBOARDRow TriggerRow in
insightDataSet.CASC_WALLBOARD)
{
DataRow dr = TriggerRow;
lock (POLICY_QUEUE)
{
POLICY_QUEUE.Enqueue(dr);
}
TriggerRow.Delete();
}
casc_WALLBOARDTableAdapter.Update(insightDataSet);
Why does the dr allways refer back to the original datarow and not the copy
I have placed in the Queue. How can I overcome this, ie save a copy of a row
to a queue ?? Is it because Datarows are only reference types ?
Any help appreciated.
Thanks
Jon.
I am using a Queue object to save the contents of a DataSet within a
'foreach' loop.
I use the .Enqueue method to add the Row to the Queue, but when the .Delete
method is called on the original row each 'field' value has the exception
'dr.ItemArray' threw an exception of type
'System.Data.DeletedRowInaccessibleException'
The code:
casc_WALLBOARDTableAdapter.Fill(insightDataSet.CASC_WALLBOARD);
foreach (InsightDataSet.CASC_WALLBOARDRow TriggerRow in
insightDataSet.CASC_WALLBOARD)
{
DataRow dr = TriggerRow;
lock (POLICY_QUEUE)
{
POLICY_QUEUE.Enqueue(dr);
}
TriggerRow.Delete();
}
casc_WALLBOARDTableAdapter.Update(insightDataSet);
Why does the dr allways refer back to the original datarow and not the copy
I have placed in the Queue. How can I overcome this, ie save a copy of a row
to a queue ?? Is it because Datarows are only reference types ?
Any help appreciated.
Thanks
Jon.