//删除用户 public bool delUser(int id) { using (Trans t = new Trans()) { try { DBHelper db = new DBHelper(); string sql = "select id from papers where teacherId=" + id; DbCommand cmd = db.GetSqlStringCommand(sql); using (DbDataReader reader = db.ExecuteReader(cmd)) { while (reader.Read()) { TeacherFunctionForm.delPaper((int)reader[0]); } } delInScores(id, t); delInStu_answers(id, t); delInUsers(id, t); t.Commit(); return(true); } catch { t.RollBack(); return(false); } } }
private void TeacherForm_Load(object sender, EventArgs e) { ViewHelper.size = this.Size; _tchFunction = new TeacherFunctionForm(); tchFunction.MdiParent = this; tchFunction.Show(); _tchWelcome = new TeacherWelcomeForm(); tchWelcome.MdiParent = this; tchWelcome.Show(); this.Opacity = 100D; }
public void delInUsers(int id, Trans t) { string sql = "delete from users where id=" + id; TeacherFunctionForm.executeDel(sql, t); }
public void delInStu_answers(int id, Trans t) { string sql = "delete from stu_answers where studentId=" + id; TeacherFunctionForm.executeDel(sql, t); }