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

Popular posts from this blog

php - How to pass multiple values from url -

database - php search bar when I press submit with nothing in the search bar it shows all the data -

ios - How to load .png images from Documents folder of an app -