Reputation: 7472
Is it possible to use Linq-to-Sql to execute a stored procedure that does not return an output?
Upvotes: 1
Views: 1983
Reputation: 100607
In the Server Explorer window, browse and find your sproc. Drag it over to the Methods area in the Linq-to-Sql designer.
This stored procedure is now available as a method in your DataContext object.
e.g.
Your sproc name is IncrementCustomerVisit
and it takes one parameter of type int
.
In your app code:
using (DataContext db = new DataContext())
{
db.IncrementCustomerVisit(someCustomerID);
}
Upvotes: 5