Reputation: 1
I make a call to BD and he brings me an info which I order as follows:
Backlog.GetDocAllUsersDataTable data = service.GetDocAllUsersDataTable(string.Empty)
DataRow[] rows = data.Select().OrderBy(x => x["UserName"]).ToArray;
In my array 'rows' I have the BD items sorted but after I make a condition to eliminate some items, I tried with:
rows[0].Delete();
data.AcceptChanges();
But what it does is format all the fields of position 0 but it does not delete it, that is to say that if 26 records arrive I still have the same 26 and I need 25 left. Thanks ...
Upvotes: 0
Views: 159
Reputation: 5783
The ToArray
call copies the data table contents into a separate array. So rows[0].Delete()
does nothing to the original data
.
Try this instead:
Backlog.GetDocAllUsersDataTable data = service.GetDocAllUsersDataTable(string.Empty)
data.OrderBy(x => x["UserName"]).First().Delete();
data.AcceptChanges();
Upvotes: 1