How to update only one field using Entity Framework?

前端 未结 16 1856
后悔当初
后悔当初 2020-11-22 09:09

Here\'s the table

Users

UserId
UserName
Password
EmailAddress

and the code..



        
16条回答
  •  猫巷女王i
    2020-11-22 09:42

    I was looking for same and finally I found the solution

    using (CString conn = new CString())
    {
        USER user = conn.USERs.Find(CMN.CurrentUser.ID);
        user.PASSWORD = txtPass.Text;
        conn.SaveChanges();
    }
    

    believe me it work for me like a charm.

提交回复
热议问题