Database Reference
In-Depth Information
Figure 13-11. Creating a stored procedure to delete a currency
How It Works
The CREATE PROCEDURE statement created a stored procedure that has one input parameter. Parameters
are specified between the procedure name and the AS keyword. Here you specified only the parameter
name and data type, so by default it is an input parameter. Parameter names start with @ .
Create procedure sp_DeleteCurrency
@currCode nvarchar(3)
As
Delete From Sales.Currency
This parameter is used in the WHERE clause of the query.
Where CurrencyCode = @currCode
Try It: Using a Stored Procedure with the ExecuteNonQuery Method
To use the ExecuteNonQuery method, follow these steps:
1. Select the ADO.NET_Command project, right-click, and choose Add
Windows Form. From the opened dialog, make sure Windows Form is
selected, and rename Form1.cs to CommandStoredProcedure.cs . Click OK to add
this form to the ADO.NET_Command project.
2. Select the CommandStoredProcedure form by clicking the form's title bar, and
set the Size property's Width to 288 and Height to 267.
 
Search WWH ::




Custom Search