-2

I have used db=this.getWritableDatabase(); in the constructor itself, so I havent used a specific open or close function. Should I?

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);
}

1 Answers1

0

Try the following:

db.update(TB_cabs, val, "cab_id=?", new String[] {cab_id2});
Gerard Frijters
  • 348
  • 3
  • 11