I am a lazy person, therefor I like to not scratch up a small concsole application if I don't need to.

I'd like to update a few listitems via Linqpad.

I can query the items just fine, but how do I update them? In my case I just need to replace the word "Neu" with "New" in a certain field.

//using OData calling /_vti_bin/listdata.svc
var ItemsToUpdate = Orders.Where(t => t.Status == "Neu")
foreach(var item in ItemsToUpdate)
  item.Status = "New";

Normally I'd call Context.SaveChanges() but in LinqPad I haven't defined a context. How can I submit my changes to the list? You see, that I use Dump() before and after the newly assigned Status value of New. It goes like expected (neu New Neu New Neu New ....). The problem really just seems to be the submitting and saving of those changes.

Kind regards

  • yes, I tried, but there is no extensionmethod Update(); – Marco Jul 4 '13 at 11:39

the solution is as following:

foreach(var item in ItemstoUpdate)
  item.Status = "New";

I didn't know I had to use UpdateObject(object)


Can't you just type SaveChanges(); directly.

  • I can, but the Update is not passed to the server. The data stays as it is. – Marco Jul 4 '13 at 11:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.