当前位置: 首页 > 网络学院 > 服务端脚本教程 > ADO > ADO Find 方法
The Find method searches for a record in a Recordset that satisfies a specified criteria. If the search is successful, the record pointer will point to the first found record.
Find的作用是:按照具体制定的规则在记录集中搜索一条记录。如果搜索成功,那么记录指针将指向首先被发现的记录。
Note: A current row position (like MoveFirst) must be set before calling this method, otherwise an error will occur.
注意:必须在请求该方法之前设置当前行的位置,否则将发生错误。
objRecordset.Find(criteria,skiprows,direction,start) |
Parameter参数 | Description描述 |
---|---|
criteria | Required. The column name, comparison operator, and value to use in the search. 必要参数。指定列的名称、比较运算符以及用于搜索的值 Examples: "Country='Norway'" Note: This method does not support multi-column searches (AND or OR) |
skiprows | Optional. Specifies how many records beyond the current record to skip before beginning the search. Default is 0 可选参数。指定在开始搜索之前从当前记录起需要跳过的记录数量。默认值为0 |
direction | Optional. A SearchDirectionEnum value that specifies the search direction 可选参数。指定一个SearchDirectionEnum值,用于指明搜索方向 |
start | Optional. The starting position for the search 可选参数。指定搜索的起始位置 |
Constant 常量 | Value 值 | Description 描述 |
---|---|---|
adSearchBackward | -1 | Searches backward from the starting position. Stops at the beginning of the Recordset. If no match, the record pointer is placed at the beginning of the Recordset 指定从起始位置向后搜索记录,直到位于记录集的末尾处停止。如果无匹配项,那么记录指针将位于记录集的起始处 |
adSearchForward | 1 | Searches forward from the starting position. Stops at the end of the Recordset. If no match, the record pointer is placed at the end of the Recordset 指定从起始位置向前搜索记录,直到位于记录集的末尾处停止。如果无匹配项,那么记录指针将位于记录集的末尾处 |