Daily Archives: 06/14/2011

Stored Procedure in LINQ2SQL query

Linq2Sql has a great use of stored procedures – it converts them into methods which you can easily call using standardized .NET syntax. For example if you have SP:

ALTER PROCEDURE MyProcedure(MyParam int) ...

after dragging it into Linq2Sql designer you can call it in your .NET code like this:

Dim aResults = MyDbContext.MyProcedure(2011)

but there are 2 caveats. Continue reading →