我试过这个:
public void updateCharacter(String charName, int level, int stamina)
{
ContentValues args = new ContentValues();
//args.put(KEY_CHAR_NAME, charName);
args.put(KEY_LEVEL, level);
args.put(KEY_STAMINA, stamina);
db.update(CHARACTERS_TABLE, args, KEY_CHAR_NAME + "=" + charName, null);
}
这是我的函数调用:
db.updateCharacter("myPlayer", 2, 2);
得到这个例外:
android.database.sqlite.SQLiteException: no such column: myPlayer: , while compiling: UPDATE characters_table SET level=?, stamina=? WHERE charName=myPlayer
我 99% 确定我有这样一列我可以打印出来,我在布局中看到它在第一列中明确得到 myPlayer,即 KEY_CHAR_NAME (charName),那么有什么问题?