This is probably very easy to solve, but I am having problems updating an SQL field in Android: the following query does not contain any syntax errors but when I run the app, it crashes:
db.rawQuery("UPDATE "+ TABLE_NAME + " SET "+ FIELD_TO_UPDATE + " = " + FIELD_TO_UPDATE + 1, null);
This is the logcat:
01-08 16:45:01.269: E/AndroidRuntime(1118): FATAL EXCEPTION: main
01-08 16:45:01.269: E/AndroidRuntime(1118): android.database.sqlite.SQLiteException: no such column: smsSent1: , while compiling: UPDATE users SET smsSent = smsSent1
Basically, the last +1 is seen as a concatenation and not as a sum, how can I use the + operator to increment the SMS_SENT field?
Try this