C
Carl Mercier
Hi,
I'm trying to delete a row from a datatable at runtime but an exception is
thrown. I have no clue why since I'm not even using an iterator.
Here's my code:
' Search for deleted items at client side
For Each t As DataTable In dsWeb.Tables
For i As Integer = 0 To t.Rows.Count - 1
Dim dr As DataRow = t.Rows(i)
Dim foundRow As DataRow =
dsClient.Tables(t.TableName).Rows.Find(New Object() {dr(0), auth.User})
If foundRow Is Nothing Then
' this item was deleted
t.Rows(i).Delete() '<<<------- Exception thrown
here
Else
' Do nothing
End If
Next
Next
The exception is of type DeletedRowInaccessibleException (.Message = Deleted
row information cannot be accessed through the row).
I made sure that every row i was trying to delete is RowState = Unchanged.
I also tried many other ways of looping and deleting the rows but without
much success.
Can anyone help here?
Thanks!
Carl
I'm trying to delete a row from a datatable at runtime but an exception is
thrown. I have no clue why since I'm not even using an iterator.
Here's my code:
' Search for deleted items at client side
For Each t As DataTable In dsWeb.Tables
For i As Integer = 0 To t.Rows.Count - 1
Dim dr As DataRow = t.Rows(i)
Dim foundRow As DataRow =
dsClient.Tables(t.TableName).Rows.Find(New Object() {dr(0), auth.User})
If foundRow Is Nothing Then
' this item was deleted
t.Rows(i).Delete() '<<<------- Exception thrown
here
Else
' Do nothing
End If
Next
Next
The exception is of type DeletedRowInaccessibleException (.Message = Deleted
row information cannot be accessed through the row).
I made sure that every row i was trying to delete is RowState = Unchanged.
I also tried many other ways of looping and deleting the rows but without
much success.
Can anyone help here?
Thanks!
Carl