I'm having a problem getting an update statement to work. I have tried it a number of different ways, but it just isn't working - I must be missing something.
private void changeScore(long personId, long categoryId, boolean sign) { int julianDay = getDayNumber(); String delta = (sign ? "+1" : "-1"); String update = "update " + TABLE_NAME + " set score=score " + delta + " where " + "" + KEY_DATE + "=" + julianDay + " and " + KEY_PERSONID + "=" + personId + " and " + KEY_CATEGORYID + "=" + categoryId; db.rawQuery(update, null); } When I log this update String, I see it as: update score set score=score +1 where day=2440588 and person_id=2 and category_id=1 I can paste that into my SQLite Manager Firefox plugin and run that against a copy of my database, and it executes as I would expect - the where values match up. I would have liked to use the SQLiteDatabase.update method, but I didn't see a way to pass the expression "score + 1" - as a value in the ContentValues it treated "score +1" as a String and not an expression. As an experiment, I change the line that defines the update String to: String update = "update " + TABLE_NAME + " set score=score " + delta; Still no love. Is there any reason an UPDATE wouldn't work in a rawQuery call? Or am I doing something else wrong? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---