I have an update method in my data layer, for example:
public clacc datalayerSec_User private objUIData as new UIData Public Function Update(ByVal objUser As SEC_USER) As Boolean Try objUIData.SEC_USERs.Attach(objUser) objUIData.Refresh(RefreshMode.KeepCurrentValues, objUser) objUIData.SubmitChanges(ConflictMode.ContinueOnConflict) Return True Catch ex As Exception Throw ex End Try End Function end class
And I am writing this code to update my data:
Dim tmpUser As New UI_Class.BAL.Security.cls_SEC_USER Dim tblUser = tmpUser.GetAll.SingleOrDefault(Function(x) x.DS_OPENID = pOpenID) tblUser.DT_LAST_LOGIN = DateTime.Now tmpUser.Update(tblUser)
When I started it, I have this error message: it is impossible to attach an entity that already exists.
How can this be fixed?
source share