O'Reilly logo

Microsoft® Visual Studio® 2010 Unleashed by Lars Powers, Mike Snell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a Stored Procedure in C#

First, you add a stored procedure item to your project by using the Project menu and selecting Add Stored Procedure. A new class is added to the project. Listing 21.1 shows the base code that shows up within the new class file. You can add your custom code to the static void routine UpdateEmployeeLogin.

Listing 21.1 The Start of a Managed Code Stored Procedure

image

Managed code objects in SQL Server all leverage the .NET Framework data classes (that is, ADO.NET) to do their work. This means that stored procedures you write ends up instantiating and using classes such as SqlConnection and SqlCommand. The code you write ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required