Table of Contents Previous Next


5 Using the .NET Connector : 5.6 Using SPL Stored Procedures in your .NET Application : 5.6.3 Example - Executing a Stored Procedure with IN, OUT, and INOUT Parameters

The previous example demonstrated how to pass IN parameters to a stored procedure; the following examples demonstrate how to pass IN values and return OUT values from a stored procedure.
When retrieving values from OUT parameters you must explicitly specify the direction of out parameters as Output. You can retrieve the values from Output parameters in two ways:
Call the ExecuteReader method of the EDBCommand and explicitly loop through the returned EDBDataReader, searching for the values of OUT parameters.
Call the ExecuteNonQuery method of EDBCommand and explicitly get the value of a declared Output parameter by calling that EDBParameter value property.
In each method, you must declare each parameter, indicating the direction of the parameter (ParameterDirection.Input, ParameterDirection.Output or ParameterDirection.InputOutput). Before invoking the procedure, you must provide a value for each IN and INOUT parameter. After the procedure returns, you may retrieve the OUT and INOUT parameter values from the command.Parameters[] array.
The following code listing demonstrates using the ExecuteReader method to retrieve a result set:
The following code listing demonstrates using the ExecuteNonQuery method to retrieve a result set:

5 Using the .NET Connector : 5.6 Using SPL Stored Procedures in your .NET Application : 5.6.3 Example - Executing a Stored Procedure with IN, OUT, and INOUT Parameters

Table of Contents Previous Next