Reputation: 423
I have a datatable in which I have the index number of the row that i want to delete using linq. I cant seem to get this to work properly because I am writing
int RowIndex = 3;
DataTable.AsEnumerable().ToList().RemoveAt(RowIndex);
DataTable.AcceptChanges();
There is no error but it does not remove the row.
Upvotes: 0
Views: 449
Reputation: 564433
You don't need LINQ for this. Just remove it directly:
theDataTable.Rows.RemoveAt(rowIndex);
theDataTable.AcceptChanges();
Upvotes: 4