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

Passing INPUT parameters

Passing an INPUT parameter requires several steps to provide a value as input to an application service procedure or user-defined function.
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).
The following example passes an INPUT integer parameter that does not support the Unknown value (?).
Passing an INPUT parameter using the .NET OpenAPI
// Define and initialize the variable for the input parameter
Int32 CustomerNumber = 33;

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

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

// Run the procedure or user-defined function
...
The following example passes an INPUT integer parameter that supports the Unknown value (?).
INPUT parameter as Unknown value (?) using .NET OpenAPI
// Define and initialize the variable for the input parameter
Int32 CustomerNumber = 33;

...
//Define and set the holder class for the input parameter
//to null or an integer based on the variable value
IntHolder hCustomerNumber = new IntHolder( );
iCustomerNumber = new Integer(CustomerNumber)

if (CustomerNumber > 33)
   hCustomerNumber.Value = null;
else
   hCustomerNumber.Value = (Object) iCustomerNumber;

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

// Add the input parameter to the ParamArray
parms.AddInteger(0, hCustomerNumber, ParamArrayMode.INPUT);

// Run the procedure or user-defined function
...