/** 修改班级 */ public boolean modifyClass(Classes classes, String id) { ContentValues values = new ContentValues(); values.put("class_id", classes.getClass_id()); values.put("class_name", classes.getClass_name()); values.put("class_date", classes.getClass_date()); long l = db.update("class", values, "class_id=?", new String[] {id}); return l == 1; }
/** * 保存classes到数据库 * * @param classes */ public boolean saveClass(Classes classes) { if (classes != null) { ContentValues values = new ContentValues(); values.put("class_id", classes.getClass_id()); values.put("class_name", classes.getClass_name()); values.put("class_date", classes.getClass_date()); values.put("major_id", classes.getMajor_id()); long l = db.insert("class", null, values); if (l == -1) { return false; } else { return true; } } return false; }