O'Reilly Forums: How To Update Data From Linqpad? - O'Reilly Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How To Update Data From Linqpad? Rate Topic: -----

#1 User is offline   Karel Kral 

  • New Member
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 27-November 08

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 User is offline   JoeAlbahari 

  • Super Veteran Member
  • PipPipPipPipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 529
  • Joined: 15-February 08
  • 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");



Share this topic:

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users