private void DeleteDrugInfo() { foreach (DataGridViewRow selRow in dgv.SelectedRows) { int drugId = Convert.ToInt32(Judgement.JudgeDBNullValue(selRow.Cells[DBConstDef.DRUG_ID].Value, EnumDef.ENUM_DATA_TYPE.DATA_TYPE_INTEGER)); DbMaintainment operDb = new DbMaintainment(); operDb.DeleteDrugInfo(drugId); DataRow[] selRows = ((DataTable)dgv.DataSource).Select(string.Format("{0}={1}", DBConstDef.DRUG_ID, drugId)); if (selRows.Length > 0) { ((DataTable)dgv.DataSource).Rows.Remove(selRows[0]); } } }
private void DeleteDrugInfo() { foreach (DataGridViewRow selRow in dgv.SelectedRows) { int drugId = Convert.ToInt32(Judgement.JudgeDBNullValue(selRow.Cells[DBConstDef.DRUG_ID].Value, EnumDef.ENUM_DATA_TYPE.DATA_TYPE_INTEGER)); DbMaintainment operDb = new DbMaintainment(); operDb.DeleteDrugInfo(drugId); DataRow[] selRows = ((DataTable)dgv.DataSource).Select(string.Format("{0}={1}", DBConstDef.DRUG_ID, drugId)); if (selRows.Length>0) ((DataTable)dgv.DataSource).Rows.Remove(selRows[0]); } }