Context.savechanges is not working Entity Framework
Here is my code
Using Context As New NotificationManagerEntities1
Dim User = Context.Users.First()
User.Firstname = "Shawn"
User.Lastlogin = Today.Date
Try
Cont开发者_Go百科ext.SaveChanges()
Catch ex As Exception
End Try
End Using
This executes fine with no exceptions, but when i look at the table it still has the same orginal value.
Im using a .sdf database with vs 2008
you sure it's not throwing an exception? your try/catch clause appears to simply swallow the exception without surfacing it.
You're not adding it to the entity. You are just creating the object. You need to call your entities add method.
I'm not a VB guy, so I am not sure on the syntax, but here's how to do it in C#
context.MyEntity.Add(newEntity);
精彩评论