c# - How to delete specific entries from a table using Linq? -
c# - How to delete specific entries from a table using Linq? -
class programme { static void main(string[] args) { pricingdemoentities demo = new pricingdemoentities(); var output = (from result in demo.demotables result.value == "array" select result).tolist(); output.removeall(x = > x.value == "array"); demo.savechanges(); }
i want delete entries in table value = "array" using linq alone. tried in above way. values deleted in list not updated table. please suggest solution .![enter image description here][1]
you not removing them db, doing modify output list has nil db context.
foreach(var entry in output) demo.demotables.remove(entry); demo.savechanges(); in add-on should utilize using statement dispose dbcontext.
using(var demo = new pricingdemoentities()) { ... } c# linq
Comments
Post a Comment