예제 #1
0
 /** 修改专业 */
 public boolean modifyMajor(Major major, String id) {
   ContentValues values = new ContentValues();
   values.put("major_id", major.getMajor_id());
   values.put("major_name", major.getMajor_name());
   long l = db.update("major", values, "major_id=?", new String[] {id});
   return l == 1;
 }
예제 #2
0
 /** @param major 保存major到数据库 */
 public boolean saveMajor(Major major) {
   if (major != null) {
     ContentValues values = new ContentValues();
     values.put("major_id", major.getMajor_id());
     values.put("major_name", major.getMajor_name());
     long l = db.insert("major", null, values);
     if (l == -1) {
       return false;
     } else {
       return true;
     }
   }
   return false;
 }