- - - - -

How To Update Data From Linqpad?

  • Please log in to reply
1 reply to this topic

#1 Karel Kral

Karel Kral

    New Member

  • Members
  • Pip
  • 2 posts

Posted 28 November 2008 - 01:38 AM

Hello, I am very satisfied user of LINQPad. I am using it instead of MS Management Studio for all select queries. I works as charm.

But is there any posibility how to delete or update data from LINQ query from LINQPad? I just tried obvious LINQ syntax from C# but I'm in stuck - I cannot find way how to accomplish this.

Can You suggest me any way?

#2 JoeAlbahari


    Super Veteran Member

  • Members
  • PipPipPipPipPipPipPipPipPipPipPip
  • 529 posts
  • Gender:Male
  • Location:Perth, Australia

Posted 28 November 2008 - 02:09 AM

Hi Karel

Here's how to insert, update and delete a customer using the sample database in LINQPad:

Customer cust = new Customer { ID=1000, Name="Bloggs" };
Customers.InsertOnSubmit (cust);

Customers.Dump ("After inserting");

cust.Name = "Bloggs2";
SubmitChanges();                 // Updates the customer

Customers.Dump ("After updating");

Customers.DeleteOnSubmit (cust);
SubmitChanges();                 // Deletes the customer

Customers.Dump ("After deleting");



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users