ICommandWithParameters:: MapParameterNames

Returns an array of parameter ordinals when given named parameters.

HRESULT MapParameterNames (
   ULONG               cParamNames,
   const OLECHAR *      rgParamNames[],
   LONG                  rgParamOrdinals[]);

Parameters

cParamNames

[in]
The number of parameter names to map. If cParamNames is zero, MapParameterNames does nothing and returns S_OK.

rgParamNames

[in]
An array of parameter names of which to determine the parameter ordinals. If a parameter name is not found, the corresponding element of rgParamOrdinals is set to zero and the method returns DB_S_ERRORSOCCURRED.

rgParamOrdinals

[out]
An array of cParamNames ordinals of the parameters identified by the elements of rgParamNames. The consumer allocates (but is not required to initialize) memory for this array and passes the address of this memory to the provider. The provider returns the parameter ordinals in the array.

Return Code

S_OK
The method succeeded. Each element of rgParamOrdinals is set to a nonzero value.

DB_S_ERRORSOCCURRED
An element of rgParamNames was invalid. The corresponding element of rgParamOrdinals is set to zero.

E_FAIL
A provider-specific error occurred.

E_INVALIDARG
cParamNames was not zero and rgParamNames or rgParamOrdinals was a null pointer.

DB_E_ERRORSOCCURRED
All elements of rgParamNames were invalid. All elements of rgParamOrdinals are set to zero.

DB_E_NOCOMMAND
No command text was currently set on the Command object and no parameter information had been specified with SetParameterInfo.

DB_E_NOTPREPARED
The provider can derive parameter information and supports command preparation. However, the command was in an unprepared state and no parameter information had been specified with SetParameterInfo.

See Also

ICommandWithParameters::GetParameterInfo