Error trying to remove row from Datatable
Posted on 2007-04-10
I am trying to remove a row from a DataTable..
The DataTable is stored in memory so removing this row dows not delete data from the database..
My code currently is
private void Delete_Record(int prodid)
DataTable dto = new DataTable();
dto = ((DataTable)Session["prodDT"]);
foreach (DataRow r in dto.Rows)
int id = Convert.ToInt32(r["ID"]);
if (id == prodid)
This give me an error
Collection was modified; enumeration operation might not execute.
Can someone help me out here..