mardi 26 avril 2016

Update query SQLite gives Null Pointer Exception

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

Aucun commentaire:

Enregistrer un commentaire