// 删除 public int delete(int rid) { Connection dbConn = DataBaseTool.getConnection(); String sql = "delete from t_register where id=" + rid; int count = DataBaseTool.executeSQL(dbConn, sql); DataBaseTool.close(null, null, dbConn); return count; }
// 添加 public int add(TRegister register) throws Exception { Connection dbConn = DataBaseTool.getConnection(); String sql = "insert into t_register(user_id,arrangement_id,number,type,validate) values(" + register.getUserId() + "," + register.getArrangementId() + ",'" + register.getNumber() + "'," + register.getType() + "," + register.getValidate() + ")"; int count = DataBaseTool.executeSQL(dbConn, sql); DataBaseTool.close(null, null, dbConn); return count; }
// 更新 public int update(TRegister register) throws Exception { Connection dbConn = DataBaseTool.getConnection(); String sql = "update t_register set user_id=" + register.getUserId() + " , arrangement_id=" + register.getArrangementId() + " , type=" + register.getType() + " , validate=" + register.getValidate() + " , number='" + register.getNumber() + "' where id=" + register.getId(); int count = DataBaseTool.executeSQL(dbConn, sql); DataBaseTool.close(null, null, dbConn); return count; }