|
如何在WinForm中對BindingSource進行過濾,並將符合條件的的記錄進行刪除? |
|
|
可以用下列的程式來過濾與刪除資料,如下: OEnergyDetail.MoveFirst(); int ibsOEDcount = ibsOEnergyDetail.Count; int i = 0; while (i< ibsOEDcount) { DataRowView dr = (DataRowView)ibsOEnergyDetail.Current; if (dr["housecode"].ToString() == "D") // 將HouseCode為’D’的刪除 { ibsOEnergyDetail.RemoveCurrent(); } else { ibsOEnergyDetail.MoveNext(); } i++; } ibsOEnergyDetail.EndEdit();
|
|
|