There are many advantages to incorporating stored procedures into your application logic including: This article will show you how to use stored procedures in conjunction with the Sql Data Adapter in order to fill and update data contained in a Data Set.
Your saved stored procedure should show up under the Stored Procedure node in the Server Explorer window.
Notice that the CREATE keyword has been changed to the ALTER keyword in the Code Editor window.
After you've declared the procedure name, you'll declare any parameters that the stored procedure will use.
The AS keyword follows the parameter declarations, and then you can see the SQL code that makes up the body of the stored procedure.
Once you have entered the code into the Code Editor window, save the stored procedure.
Note: Stored procedures can also use a Return parameter and an Input Output parameter type.You can use the RETURN keyword to exit from the stored procedure.This is where you can send an integer status value back to the caller.Enter some test data making sure you use a pub_id that corresponds to an existing publisher and click OK to run the stored procedure.After you execute the stored procedure, right-click the publisher table node in the Server Explorer window and choose Retrieve Data from Table. In order to fill a Data Set with the publisher information, you can use a Sql Data Adapter as a broker between the SQL Server and the Data Set.SQL Server writes the output from the stored procedure to the Output window.