Search code examples
androidsqliteauthenticationregistrationsqliteopenhelper

Update Sqlite Table in Android


I am getting a error when updating my table... Error:

android.database.sqlite.SQLiteException: near ".40609543": syntax error (code 1): , while compiling: UPDATE login SET lname=?,profile_pic=?,email=?,fname=?,mobile=? WHERE uid=5700e194537378.40609543

My SQLiteOpenHelper Class code

public void updateProfile(String fname, String lname, String email, String mobile, String profile_pic, String uid) {
    SQLiteDatabase db = this.getWritableDatabase();
    ContentValues updateValues = new ContentValues();
    updateValues.put(KEY_FIRSTNAME, fname); // FirstName
    updateValues.put(KEY_LASTNAME, lname); // LastName
    updateValues.put(KEY_EMAIL, email); // Email
    updateValues.put(KEY_MOBILE, mobile); // Mobile Number
    updateValues.put(KEY_PROFILE_PIC, profile_pic);

    db.update(TABLE_LOGIN, updateValues, KEY_UID + "=" + uid, null);
    db.close();
}

Solution

  • Try this once.

    db.update(TABLE_LOGIN, updateValues, KEY_UID + "=?", new String[] { String.valueOf(uid) });