Using Stored Procedures in Conjunction with the SqlDataAdapter
A well-designed application that uses a relational database management system in the backend should make extensive use of stored procedures. A stored procedure is a named collection of SQL statements that you store in a database. A stored procedure is similar to a function. You call the stored procedure by name, you can pass it parameter values, and it can return parameter values back to the calling code.
by Dan Clark
May 9, 2003
Page 1 of 3
ncapsulating data update logic in stored procedures is an excellent way to improve the manageability, scalability, and security of your database-driven applications. There are many advantages to incorporating stored procedures into your application logic including:
Shared application logic among various client applications
Reduced network traffic
Improved database security
This article will show you how to use stored procedures in conjunction with the SqlDataAdapter in order to fill and update data contained in a DataSet.
Creating a Stored Procedure
Creating a stored procedure is a fairly straightforward process which you can complete inside the Visual Studio .NET IDE. Open Visual Studio .NET and navigate to the Pubs database node in the Server Explorer window and expand the node. You should see a Stored Procedures node (see Figure 1). Right-click on the Stored Procedures node to launch a popup menu. Select the option to create a new stored procedure.