Error In C# When I Delete A Row
I recive 'DeletedRowInaccessible Exception','Deleted Row Information cannot be accessed through the row'.
I Recived this Exception on this Code when Delete a row.
BindingSource_ListChanged(-)
{
payment=(from row in ServiceDataset.ServiceDataset.ServiceOrderPayments
where row.Code==ServiceOrdersRow.Code
select row.payment).sum()
}
i use this code to calculate sum of payments.
but when i delete a row and rowstate of row set to Deleted I recive this Error.
开发者_如何学JAVAplz help me
Check the where, there should be a '==':
row.Code == ServiceOrdersRow.Code
I would expect that ServiceOrderPayments
, assuming it's a table in a typed dataset, would already exclude deleted rows, but if not, simply updating the where
clause will fix this:
where row.RowState != DataRowState.Deleted && row.Code == ServiceOrdersRow.Code
Though you should also consider the possibility that it's ServiceOrdersRow
that has been deleted.
精彩评论