다음을 통해 공유


ICommandWithParameters::MapParameterNames

Returns an array of parameter ordinals when given named parameters.

Syntax

HRESULT MapParameterNames (
   DB_UPARAMS        cParamNames,
   const OLECHAR    *rgParamNames[],
   DB_LPARAMS        rgParamOrdinals[]);

Parameters

  • cParamNames
    [in] The number of parameter names to map. If cParamNames is zero, ICommandWithParameters::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.

    cParamNames was zero; the method succeeded but did nothing. This return code supersedes E_INVALIDARG if cParamNames was zero and either or both rgParamNames and rgParamOrdinals was a null pointer.

  • 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 ICommandWithParameters::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 ICommandWithParameters::SetParameterInfo.

See Also

Reference

ICommandWithParameters::GetParameterInfo