Executing Stored Procedures
Stored procedures are a performance-optimized, robust way to encapsulate and compile queries on a database server. In this section, you see how to execute stored procedures using the SQL Server .NET Data Provider and the classes in the System.Data.SqlClient namespace.
Supplying Input Parameters
If we were to revisit our SQL code responsible for inserting employee records and place that code into a stored procedure, we would end up with something like the SQL code shown in Listing 15.4.
Listing 15.4. A Record Insert with Parameters
USE dbHumanRes GO CREATE PROCEDURE insert_employee (@id int, @first_name varchar(25), @middle_initial char(1), @last_name varchar(25), @extension char(4), @job_code char(4), @division_id ... |
Get Visual Basic® Programmer's Guide to the .NET Framework Class Library 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.