2016-12-30 47 views
1
public void updateEntry(String eMail, String password) 
{ 
    // Define the updated row content. 
    ContentValues updatedValues = new ContentValues(); 
    // Assign values for each row. 

    updatedValues.put("EMAIL", eMail); 
    updatedValues.put("PASSWORD", password); 

    String where = "EMAIL = ?"; 
    db.update("LOGIN", updatedValues, where, new String[] { eMail }); 
} 

我只能更新我的密碼(我創建了四個字段名稱,密碼,電子郵件,電話)。這個可以嗎?更新Android上sqllite的具體數值

+0

,如果你只想要更改您的密碼,那麼你並不需要爲您的電子郵件做到這一點。你可以刪除這一行updatedValues.put(「EMAIL」,eMail); – xFighter

+0

其餘的,如果EMAIL是唯一的,那麼這似乎是正確的(如果你採取xFighter建議)。 – AxelH

回答

0

更新密碼進入數據庫,基於輸入mail_id ..可以使用where子句爲此,..