开发者

Error In C# When I Delete A Row

开发者 https://www.devze.com 2022-12-15 17:36 出处:网络
I recive \'DeletedRowInaccessible Exception\',\'Deleted Row Information cannot be accessed through the 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消