Tuesday, February 19, 2008

LINQ - ChangeConflictException when updating row

System.Data.Linq.ChangeConflictException: Row not found or changed


I had very simple 4 lines:

ltsRmzLightDataContext data = new ltsRmzLightDataContext();

invitation = data.Invitations.SingleOrDefault(email => email.Id == invitationId);

if (invitation != null)

{

invitation.IsAccepted = true;

data.SubmitChanges();

}

and was getting System.Data.Linq.ChangeConflictException: Row not found or changed in this simple piece.

After long googling I fed up and reviewed my class in designer. For me, my problem was that I added few properties and one of them has incorrect name and NUllable property set.

After fixing this it all started to work fine.



Applies to all dotnet languages: C#, VB.NET, C++.NET, J#

Labels:

1 Comments:

At 4:41 PM, Blogger Matan Lurey said...

I spent about 2 hours at work trying to figure this out... You did it! Thanks

 

Post a Comment

<< Home