作者:友尔哥_398 | 来源:互联网 | 2023-08-08 10:54
Itrytoincreasethevalueofanintegerkeyinarowinmytable.However,nothingreallyseemsto
I try to increase the value of an integer key in a row in my table. However, nothing really seems to happen.
我尝试在表中的行中增加整数键的值。然而,似乎没有任何事情发生。
db.rawQuery("UPDATE table SET key = key + 1 WHERE name=?", new String[] {name});
However, this code works fine (just sets the key to a hard-coded value):
但是,此代码工作正常(只需将密钥设置为硬编码值):
ContentValues values = new ContentValues();
values.put("key", 2);
db.update("table", values, "name=?", new String[] {name});
Also tried '?' instead of just ?, but it resulted just in a run-time error.
还试过'?'而不只是?,但它只是导致运行时错误。
1 个解决方案