我用过db = this.getWritableDatabase();在构造函数本身,所以我没有使用特定的打开或关闭功能。我是不是该?
public void changeCabLocation(String to_loc, String cab_id2) {
// TODO Auto-generated method stub
ContentValues val=new ContentValues();
val.put(cab_location, to_loc);
db.update(TB_cabs, val, cab_id+"="+cab_id2, null);
}
public void changeDriverLocation(String to_loc, String driver_id2) {
// TODO Auto-generated method stub
ContentValues val=new ContentValues();
val.put(driver_location, to_loc);
db.update(TB_drivers, val, driver_id+"="+driver_id2, null);
}
答案 0 :(得分:0)
尝试以下方法:
db.update(TB_cabs, val, "cab_id=?", new String[] {cab_id2});