Creating the Stored Procedure Assembly

Creating a stored procedure with .NET Framework is easy. All you need to do is decorate a method with the SqlProcedure attribute.

The method used for the stored procedure must satisfy two requirements. The method must be a shared (static) method. Furthermore, the method must be implemented either as a subroutine or as a function that returns an integer value.

Within your method, you can take advantage of the SqlPipe class to send results back to your application. The SqlPipe class supports the following methods:

Send() Enables you to send a DataReader, single-row resultset, or string.

ExecuteAndSend() Enables you to execute a SqlCommand and send the results.

SendResultsStart() Enables you to initiate ...

Get ASP.NET 4 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.