LINQ not updating on .SubmitChanges()

后端 未结 2 449
广开言路
广开言路 2020-11-29 09:47

Is there any reason something like this would not work?

This is the logic I have used many times to update a record in a table with LINQ:

 DataClasse         


        
相关标签:
2条回答
  • 2020-11-29 10:52

    Is the InUse property a "normal" one as far as LINQ is concerned? (e.g. it's not autogenerated or anything funky like that?)

    Alternatively, I don't suppose it's a Nullable<bool> is it, with a current value of null? If so, your update line isn't actually doing anything - for nullable Booleans, !null = null.

    0 讨论(0)
  • 2020-11-29 10:53

    The table could not be updated properly because it had no primary key. (Actually it had the column but the constraint was not copied when I did a SELECT INTO my dev table). The DataContext class requires a primary key for updates.

    0 讨论(0)
提交回复
热议问题