Inserting into a Table with LINQ to SQL


While creating a little project, I wanted to know how to insert an object into a table using LINQ to SQL. Using Intellisense it wasn’t obvious at all.

Scott Guthrie wrote a post on how do it. Unfortunately, the method name has changed since he did it, so you need to call InsertOnSubmit on the Table instead of Add, as he described it.

Phew! Getting that far was hard enough!

  • Thanks ALOT :D

    I couldnt get the add thing to work, and ive been surfing for a solution for hours now..

You can follow any responses to this entry through the RSS 2.0 feed.