LINQ to SQL – ‘Row not found or changed‘

Posted by | September 23, 2010 | ASP.NET, Web Development | 12 Comments
optimistic_concurrency_checking

This System.Data.Linq.Changeconflictexception with the message ‘Row not found or changed‘ appears to be a very annoying bug or error, but this is not the first time that i am getting this error while updating database record with Linq to SQL on ASP.NET. I tried to re-drag SQL tables from server explorer to the designer and rebuild the solution. I am still getting the ‘Row not found or changed’; there is a lack of details.

Reading on other blogs, found this from readme:
Tables with columns of type DateTime with higher precision than seconds do not update correctly. Blinq creates BoundField objects for DateTime fields that do not contain precision beyond seconds, so updates with DateTime fields with high precision that participate in optimistic concurrency fail. To fix this, do one of the following:

Change the precision displayed by the BoundField object by setting DataFormatString=”{0:o}”, HtmlEncode=false, and ApplyFormatInEditMode=true.

Designate the DateTime field as never participating in optimistic concurrency. See “Changing a Field’s Update Mode” earlier in this document to change the update mode for this column. Use this option carefully—removing this column from participating in optimistic concurrency will allow overwrites of the value to succeed even if the database’s value has been changed.

MSDN document for ChangeConflictException:
avatar

About Farid

Creative web developer/designer, big fan of HTML5, CSS3 and client-side development. Software developer at Allegra Strategies London.

  • Nino

    Goed bezig saghbi.

  • jim

    Thats exactly what i was looking for. simple solution.

  • Farid Hayati

    thanks sagbhi Ik moet exceptions ergens kwijt kunnen:P. Zo kan ik het terug vinden met de oplossing.

  • http://www.azitamiakhel.org Azita

    Sounds very intresting, but the problem is that I dont understand the logic of computer siences :) I think the best way of understaning this complicated subject is to get engaged to a system administrater, like I did :)

  • Nino

    Saghbi gewoon deze:

    try {
    // Anything goes….
    } catch (Exception e) {
    // Ignore… :P
    }

    Ja dit is inderdaad een goede manier om dingen bij te houden saghbi, kunt altijd snel nalezen.

  • Nino

    Farid you should get Azita also into programming, let her also do ASP.NET hehe ;)

  • Farid Hayati

    Haha Nino straks komt ze met hexadecimal, dan moet ik het gaan uitleggen als programmeur:P.

  • http://mellowinsurance.info ipa health insurance

    Katrina rocks!?!

  • http://insuranceslaws.info fl insurance license

    I’m glad that you wrote that…

  • http://celtic-insurance.info massotherapy insurance

    Leah, whatever man :D

    Louisa

  • http://vlcmediaplayerfreedownload.org vlc media player free downloaD

    hello

  • http://www.autismsymptomsblog.com autism symptoms

    It’s really a nice and helpful piece of information. I’m glad that you shared this helpful info with us. Please keep us informed like this. Thanks for sharing.