tags:

views:

69

answers:

1

My record: (ID, name, count)

(1, 1, 2)
(2, t, 10)

It works: myDbHelper.updateCount("1", 100);

It didn't work: myDbHelper.updateCount("t", 100); It gave android.database.sqlite.SQLiteException:no such column: t: , while compiling: ...

Here is the code for updating records:

public int updateCount(String name, int count) {
    ContentValues args = new ContentValues(); 
    args.put(KEY_COUNT, count);
    return mDb.update(DATABASE_TABLE, args, KEY_NAME + "=" + name, null);    
}
A: 

It works once I changed where condition from name column to id column. Maybe SQLite database doesn't like to use String in the where condition.

Tong