Share via


find

Searches for a set of values specified in varSval, in column iColumn starting at iRow. Upon successful completion, the row number with the matching value is returned in piRowFound.

Important

This feature will be removed in a future version of Windows. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Instead, write a fully functional OLE DB provider using the native OLE DB interfaces.

Syntax

HRESULT find (
   DBROWCOUNT     iRowStart,
   DB_LORDINAL    iColumn,
   VARIANT        varSval,
   OSPFIND        findFlags,
   OSPCOMP        compType,
   DBROWCOUNT    *piRowFound);

Parameters

  • iRowStart
    [in] Position of the first row of the data set at which the search operation begins.

  • iColumn
    [in] Position of the first column of the data set at which the search operation begins.

  • varSvalt
    [in] The target value or values of the search operation.

  • findFlags
    [in] An enumeration consisting of the values defined in the following table.

    Value

    Meaning

    OSPFIND_DEFAULT = 0

    Specifies that the search operation should be in ascending order through rows in a case-insensitive manner.

    OSPFIND_UP = 1

    Specifies that the search operation should be in descending order through rows.

    OSPFIND_CASESENSITIVE = 2

    Specifies case-sensitivity for the search.

    OSPFIND_UPCASESENSITIVE = 3

    Specifies that the search operation should be in ascending order through rows in a case-sensitive manner.

  • compType
    [in] An enumeration consisting of the the values defined in the following table.

    Value

    Meaning

    OSPCOMP_EQ = 1 OSPCOMP_DEFAULT = 1

    Specifies that the search is for the first value equal to varSval.

    OSPCOMP_LT = 2

    Specifies that the search is for the first value less than varSval.

    OSPCOMP_LE = 3

    Specifies that the search is for the first value less than or equal to varSval.

    OSPCOMP_GE = 4

    Specifies that the search is for the first value greater than or equal to varSval.

    OSPCOMP_GT = 5

    Specifies that the search is for the first value greater than varSval.

    OSPCOMP_NE = 6

    Specifies that the search is for the first value not equal to varSval.

  • piRowFound
    [out] The number of the row containing the matching value of the search. If no corresponding match is found, OLEDBSimpleProvider::find should return the constant -1.

Return Codes

  • S_OK
    The method succeeded.

  • DISP_E_TYPEMISMATCH
    The provider was unable to match the type of the varSval to the underlying type of the column.

  • E_FAIL
    A provider-specific error occurred.

Comments

Using the native type of the underlying column, OLEDBSimpleProvider::find performs compares. Providers should return DISP_E_TYPEMISMATCH when they are unable to convert the varSval to the underlying type of the column.

Comparing string values always compares values as they would be returned from a call to OLEDBSimpleProvider::getVariant with OSPFORMAT_FORMATTED. Providers should not coerce values of varSval obtained from a previous call to OLEDBSimpleProvider::getVariant with OSPFORMAT_HTML.