Try OpenEdge Now
skip to main content
.NET Open Clients
Using the Open Client .NET OpenAPI to Directly Access the AppServer : Passing parameters : Passing INTPUT-OUTPUT parameters
 

Passing INTPUT-OUTPUT parameters

Passing an INPUT-OUTPUT parameter requires several steps to provide a value as input to an application service procedure or user-defined function, then to return a value as output using the same parameter.
To pass an INPUT parameter:
1. Create and initialize a variable for the parameter of the correct .NET data type (see Creatingvariables for parameters).
2. Add the parameter to a ParamArray object (see Settingup a parameter array).
3. Run the procedure or user-defined function (see Running procedures and user-defined functions).
4. Get the output value from the ParamArray (see GettingOUTPUT parameter values). You might also want to reset the variable.
The following example passes an INPUT-OUTPUT integer parameter that does not support the Unknown value (?).
Passing an INPUT-OUTPUT parameter using the .NET OpenAPI
// Define and initialize the variable for the input-output parameter
Int32 CustomerNumber = 33;

// Create the ParamArray
ParamArray parms = new ParamArray(1);

// Add the input-output parameter to the ParamArray
parms.AddInteger(0, CustomerNumber, ParamArrayMode.INPUT_OUTPUT);

// Run the procedure
...

// Fill output parameter
// The output value is always returned as an Object
// You need to cast the Object before assigning it.
CustomerNumber = (Int32) parms.GetOutputParameter(0);