Direction Property

        Applies To

Sets or returns a value that indicates whether a CdbParameter object represents an input parameter, an output parameter, both, or the return value from the procedure (ODBCDirect workspaces only).

Syntax

VOIDSetDirection(SHORT i);

SHORTGetDirection(VOID);

Parameters

Type Example Description
SHORT i A Short with one of the values shown in Remarks.

Remarks

The Direction property can be any of the following constants:

Constant Description
dbParamInput (Default) Passes information to the procedure.
dbParamInputOutput Passes information both to and from the procedure.
dbParamOutput Returns information from the procedure as in an output parameter in SQL.
dbParamReturnValue Passes the return value from a procedure.

Use the Direction property to determine whether the parameter is an input parameter, output parameter, both, or the return value from the procedure. Some ODBC drivers do not provide information on the direction of parameters to a SELECT statement or procedure call. In these cases, it is necessary to set the direction prior to executing the query.

For example, the following procedure returns a value from a stored procedure named "get_employees":

{? = call get_employees}

This call produces one parameter — the return value. You need to set the direction of this parameter to dbParamOutput or dbParamReturnValue before executing the CdbQueryDef.

You need to set all parameter directions except dbParamInput before accessing or setting the values of the parameters and before executing the CdbQueryDef.

You should use dbParamReturnValue for return values, but in cases where that option is not supported by the driver or the server, you can use dbParamOutput instead.

Note The Microsoft SQL Server 6.0 driver automatically sets the Direction property for all procedure parameters. Not all ODBC drivers can determine the direction of a query parameter. In these cases, it is necessary to set the direction prior to executing the query.