My little problem is: I have SQLite DB in my app, which contains parameters of cards such as cardInBaseID
(not id of a row), cardName
, cardValue
etc. Now my DB has different cards which have cardInBaseID = 0 ; I want to find first row in DB which contains cardInBaseId = 0
, and update this value only for this row, not for all. How i can to this?
My method updateID works incorrect and update all rows which contains cardInBaseID=0
:
public int updateID(String id ,String newID){
SQLiteDatabase db =helper.getWritableDatabase();
ContentValues cv=new ContentValues();
cv.put(helper.KEY_CARD_IN_BASE_ID,newID);
String[] whereArgs ={id};
int count=db.update(helper.TABLE_NAME,cv,helper.KEY_CARD_IN_BASE_ID+" =? ",whereArgs);
return count;
}
Thanks for help
Aucun commentaire:
Enregistrer un commentaire