Try OpenEdge Now
skip to main content
.NET Open Clients
Using the Open Client .NET OpenAPI to Directly Access the AppServer : Handling returned values : Getting OUTPUT parameter values
 

Getting OUTPUT parameter values

After running a procedure or user-defined function, you can access the OUTPUT parameters using the following ParamArray method:

Syntax

public System.Object GetOutputParameter(int paramNum)
paramNum
Specifies the 0-based position of the parameter.
The output value is always returned as a System.Object. If the Object returned cannot be null, you need to cast the Object to the output parameter data type and assign it to the output variable you have created to hold the cast value. If the Object returned can be null, you need to assign it to the Value property of a holder object, then test for null before obtaining the appropriate data type value as output.
The following example shows getting an output integer parameter (or the output side of an input-output parameter) that might be set to the Unknown value (?) in ABL.
Getting output parameters using the .NET OpenAPI
IntHolder hCustomerNumber = new IntHolder( );
Int32 CustomerNumber = 33;

// Set the parameter and run the procedure
ParamArray parms = new ParamArray(1);
parms.AddInteger(0, CustomerNumber, ParamArrayMode.INPUT-OUTPUT);
...

// Fill the output parameter
hCustomerNumber.Value = parms.GetOutputParameter(0);
if (hCustomerNumber.IsNull == true) ...;
else CustomerNumber = hCustomerNumber.IntValue;
...