Ilkin Turk

Ilkin Turk

  • NA
  • 349
  • 161.2k

DataTable delete row

Apr 11 2013 6:42 AM
Hello When I try to delete row from datatable get error : Collection was modified; enumeration operation might not execute.

My code is below :
foreach (DataRow dr in dt.Rows)
            {
                if(dr["Name"]=="")
                {
                    dr.Delete();
                    
                }
                    dtr.AcceptChanges();
            }
If any idea give please.Or may be there are another way.

Answers (1)