问题
using (var db = new dbEntities())
{
var dbUser = (from u in db.Users
where u.Id == Id
select u).First();
dbUser.LastName = LastName;
dbUser.FirstName = FirstName;
dbUser.GroupId = GroupId;
dbUser.VoicesCount = VoicesCount;
db.SaveChanges();
}
This does not save any changes to the database. But there are no exceptions, either. Why?
UPD: Ok, I tried it also for SQL Server CE and nothing changes. It doesn't save the changed data.
回答1:
Look in you bin/debug folder for a copy of the database, it will have the changed data, as you are including the database a content with your app
来源:https://stackoverflow.com/questions/10772713/entity-framework-savechanges-does-not-save-data