LINQ to SQL

J

Jon Skeet [C# MVP]

I am working my way through ScottGu's LINQ to SQL tutorials
(http://weblogs.asp.net/scottgu/archive/2007/05/19/using-linq-to-sql-par
t-1.aspx), but am having problems with inserting and deleting data (3 :
Insert a New Category and Two New Products into the Database) and (4 :
Delete Products from the Database).

Are the RemoveAll and Add methods now out of date?  And if so, what has
replaced them?

Looking that docs for Table<TEntity> (http://msdn.microsoft.com/en-us/
library/bb336216.aspx) I suspect you want DeleteAllOnSubmit and
InsertOnSubmit.

Jon
 
J

Jon Skeet [C# MVP]

On the same tutorial, how do you call a stored proc in a LINQ data
context?  The example on the tutorial doesn't work either
(http://weblogs.asp.net/scottgu/archive/2007/05/19/using-linq-to-sql-par
t-1.aspx - 5) Call a stored procedure)

I haven't done it myself, but it's probably worth looking for examples
written in 2008, i.e. after LINQ to SQL was actually released. Even
some books were published (or at least finished) before the product
was released, which is always a problem.

Jon
 
M

Marc Gravell

Re the SPROC - that looks about right... have you dragged the SP onto
the data-context's designer surface?

What are you seeing? Does it simply not appear? Or not work?

Marc
 
M

Marc Gravell

If you mean the type is wrong - to bind an SPROC to an entity type,
you need to either drop it onto the left-hand entity, or fix the type
after the event (unless it is a trivial SP that SQLMetal can
understand - not sure if it ever bothers, though).

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top