问题
Okay i tried everyting i could, i saw all the posts here about this error and none of them solved my problem:
Here is my simple update statement, i would like to increment each itemSlotIndex by 1 at a certain characterName
String myQuery = "UPDATE " + theTable.getTableName() + " SET " + theTable.getItemSlotIndex()
+ " = " + theTable.getItemSlotIndex() + " + 1 WHERE " + theTable.getCharName() + " = "+character.getName();
Log.i("myQuery", myQuery);
theDatabase.execSQL(myQuery);
If this mumbo jumbo could be misleading, here is my logcat output for the SQL statement:
UPDATE CharsTable SET slot_index = slot_index + 1 WHERE char_name = Francis
As you see,
CharsTable is my table
slot_index is the attribute, i would like to increment
and the where claus is: I only want to update rows with char_name equals "Francis"
And the error is just wow:
02-06 19:01:13.472: E/SQLiteLog(16743): (1) no such column: Francis
No such column!!!
I got no such column error for adding a where clause parameter.
Any ideas what m i doing wrong ?
回答1:
You have forgot the '' around Francis :
UPDATE CharsTable SET slot_index = slot_index + 1 WHERE char_name = 'Francis'
... + " = '"+character.getName() + "'";
回答2:
Quotes around your string value?
来源:https://stackoverflow.com/questions/21610600/no-such-column-sqlite