-5
Caused by: android.database.sqlite.SQLiteException: no such column: kia (code 1): , while compiling: UPDATE people_chat SET msg = kia WHERE name = uol

final String CREATE_QUERY4 = "CREATE TABLE IF NOT EXISTS "+PEOPLE_CHAT+ "("+ "id INTEGER primary key autoincrement,"+ "name TEXT NOT NULL ,"+ "msg TEXT NOT NULL "+ ")";

List item

 public void upDateMsg(String name,String msg){
        Log.i(TAG, "UpdateData: "+msg);
        String strSQL = "UPDATE people_chat SET msg = "+msg+" WHERE name = "+ name;
        db.execSQL(strSQL);
        Log.i(TAG, "Update Success: "+strSQL);
    }
}
Amol Sawant
  • 13,842
  • 2
  • 20
  • 27

1 Answers1

0

It should be:

UPDATE people_chat SET msg = 'kia' WHERE name = 'uol'

You are missing single quotes. Change code to:

 String strSQL = "UPDATE people_chat SET msg = '"+msg+"' WHERE name = '"+ name+"'";

Note: As pointed out in comments, If name contains single quotes, then the query would fail. It must be escaped accordingly.

ngrashia
  • 9,869
  • 5
  • 43
  • 58