Linq to SQL DataContext.Submit Change the incorrect syntax near the Where keyword

I am working on an existing application and am trying to update a range of values ​​in a database using Entity Framework and DataContext.

Using context.SaveChanges () it gives me an error

An error occurred while calling "SubmitChanges". object: exception: System.Data.SqlClient.SqlException (0x80131904): Incorrect syntax near "WHERE" keyword. at System.Data.Linq.ChangeDirector.StandardChangeDirector.Update (TrackedObject element) at System.Data.Linq.ChangeProcessor.SubmitChanges (ConflictMode failureMode) at System.Data.Linq.DataContext.SubmitChanges (ConflictMode failureMode) failureMode

This only became a problem after adding

        var managerItem = entityDataContext.item.Single(f => f.Id == consoleItem.ID);
        managerItem.ItemCount = itemCount;
        managerItem.Cost = Cost;
        managerItem.Submit = true;

        entityDataContext.SubmitChanges();

      

After this error, two other errors also occur, one of which is the same as the one mentioned above,

other

exception System.Data.Linq.ChangeConflictException: line not found or not changed.

However, the values ​​that I need to update are being updated, so I can only assume that something else is happening or not happening.

Any help with the initial error would be gladly received.

+3


source to share





All Articles