views:

179

answers:

4

how can i call the delete store procedure in linq query

A: 

I've not used LINQ, but if you can execute raw SQL, then it'd just be:

DROP PROCEDURE myStoredProcedure
inkedmn
+1  A: 

Simply add the stored procedure that does the deletion to the database and then add the stored proceduere to your .dbml. The stored procedure would then be available as a method of your datacontext.

So if you add a stored procedure called DeleteUserse to your database and .dbml you would be able to call it like this

using (SomeWebsiteDataContext db = new SomeWebsiteDataContext())
{
    db.DeleteUsers();
}
cptScarlet
A: 

Scott Guthrie has a fairly detailed post on updating databases with Stored Procedures through LINQ:

LINQ to SQL (Part 7 - Updating our Database using Stored Procedures)

Zhaph - Ben Duguid
A: 

Give a look also to the DataContext.ExecuteCommand method.

CMS