/// <summary> /// 删除方法 /// </summary> /// <param name="id"></param> /// <returns></returns> private bool deleteData(string id) { try { BLL.TEA_STU teastuBll = new TEA_STU(); int recordCount = teastuBll.GetRecordCount("stuno = " + id); if (recordCount > 0) { MessageBox.Show("该学生信息已经被使用,不能被删除!", "提示信息"); return(false); } else { BLL.STUDENT_INFO studentBll = new STUDENT_INFO(); studentBll.Delete(id); return(true); } } catch (Exception exception) { MessageBox.Show("删除失败!", exception.Message); return(false); } }
/// <summary> /// 删除数据方法 /// </summary> /// <param name="id"></param> /// <returns></returns> private bool deleteData(int id) { try { BLL.TEA_STU teastuBll = new TEA_STU(); int recordCount = teastuBll.GetRecordCount("TEACHERNO = " + id.ToString()); if (recordCount > 0) { MessageBox.Show("该教师信息已经被使用,不能被删除!", "提示信息"); return(false); } else { BLL.TEACHER_INFO teacherbll = new TEACHER_INFO(); teacherbll.Delete(id); return(true); } } catch (Exception exception) { MessageBox.Show("删除失败!", exception.Message); return(false); } }