dimanche 4 janvier 2015

Android Sqlite update and insert only the biggest _id

I m' trying to update values only where there is the max id like this :



Cursor c = db.rawQuery("SELECT MAX(_id) FROM test3 ", null);
if (c.moveToFirst()) {
db.execSQL("UPDATE test3 SET mac='" + MAC + "',mdp='" + MDP + "'");


But all my rows change and became the same that i choose just before and i just want the maximum to change


My database is define like this :



db = openOrCreateDatabase("testDB3", Context.MODE_PRIVATE, null);
db.execSQL("CREATE TABLE IF NOT EXISTS test3(_id INTEGER PRIMARY KEY,mac VARCHAR,mdp VARCHAR,obj VARCHAR);");

Aucun commentaire:

Enregistrer un commentaire