Is it possible to use Linq-to-Sql to execute a stored procedure that does not return an output?
+4
A:
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);
}
p.campbell
2009-06-11 20:34:51