public void ClearDataStore(string DataViewName) { DataViewName = DataViewName.ToString().ToLower().Trim(); DataTable dt = _dsDataStore.Tables[0]; for(int i = dt.Rows.Count - 1; i >= 0; i--) { DataRow dr = dt.Rows[i]; string dtItem = dr["DataViewName"].ToString().ToLower().Trim(); if (dtItem == DataViewName) { dt.Rows.Remove(dr); } } _dsDataStore.Tables[0].AcceptChanges(); }>
>>Collection was modified; enumeration operation might not execute.
>>
>>>>public void ClearDataStore(string DataViewName) >>{ >> DataViewName = DataViewName.ToString().ToLower().Trim(); >> >> foreach (DataRow Row in _dsDataStore.Tables[0].Rows) >> { >> if (Row["DataViewname"].ToString().ToLower().Trim() == DataViewName) >> { >> Row.Delete(); >> } >> } >> >> _dsDataStore.Tables[0].AcceptChanges(); >>} >>>>