Microsoft SDK for Java

find

The find method of the Recordset class searches a Recordset for the row that satisfies the specified criteria. find has the following signatures:

find(String criteria)
find(String criteria, int SkipRecords)
find(String criteria, int SkipRecords, int searchDirection)
find(String criteria, int SkipRecords, int searchDirection, Object bmkStart)

Remarks

Only a single column name may be specified in criteria. This method does not support multi-column searches.

The comparison operator in criteria may be ">" (greater than), "<" (less than), "=" (equal), ">=" (greater than or equal), "<=" (less than or equal), "<>" (not equal), or "like" (pattern matching).

The value in criteria may be a string, floating point number, or date. String values are delimited with single quotes or "#" (number sign) marks (for example, "state = 'WA'" or "state = #WA#"). Date values are delimited with "#" (number sign) marks (for example, "start_date > #7/22/97#").

If the comparison operator is "like", the string value may contain an asterisk (*) to find one or more occurrences of any character or substring. For example, "state like 'M*'" matches Maine and Massachusetts. You can also use leading and trailing asterisks to find a substring contained within the values. For example, "state like '*as*'" matches Alaska, Arkansas, and Massachusetts.

Asterisks can be used only at the end of a criteria string, or together at both the beginning and end of a criteria string, as previously shown. Using the asterisk as a leading wildcard ('*str') or embedded wildcard ('s*r') causes an error.

Note   An error will occur if a current row position is not set before calling find. Any method which sets row position, such as moveFirst, should be called before calling find.

find(String criteria)

Searches a Recordset for the row that satisfies the specified criteria.

Syntax

public void find(String criteria);

Parameters

criteria A string containing a statement that specifies the column name, comparison operator, and value to use in the search.

find(String criteria, int SkipRecords)

Searches a Recordset for the row that satisfies the specified criteria.

Syntax

public void find(String criteria, int SkipRecords);

Parameters

criteria A string containing a statement that specifies the column name, comparison operator, and value to use in the search.
SkipRecords A value, whose default value is zero, that specifies the row offset from the current row or start bookmark to begin the search. By default, the search will start on the current row.

find(String criteria, int SkipRecords, int searchDirection)

Searches a Recordset for the row that satisfies the specified criteria.

Syntax

public void find(String criteria, int SkipRecords, int searchDirection);

Parameters

criteria A String containing a statement that specifies the column name, comparison operator, and value to use in the search.
SkipRecords A value, whose default value is zero, that specifies the row offset from the current row or start bookmark to begin the search. By default, the search will start on the current row.
searchDirection An AdoEnums.SearchDirection value that specifies whether the search should begin on the current row or the next available row in the direction of the search. An unsuccessful search stops at the end of the recordset if the value is FORWARD. An unsuccessful search stops at the start of the recordset if the value is BACKWARD.

find(String criteria, int SkipRecords, int searchDirection, Object bmkStart)

Searches a Recordset for the row that satisfies the specified criteria.

Syntax

public void find(String criteria, int SkipRecords, int searchDirection, Object bmkStart);

Parameters

criteria A string containing a statement that specifies the column name, comparison operator, and value to use in the search.
SkipRecords A value, whose default value is zero, that specifies the row offset from the current row or start bookmark to begin the search. By default, the search will start on the current row.
searchDirection An AdoEnums.SearchDirection value that specifies whether the search should begin on the current row or the next available row in the direction of the search. An unsuccessful search stops at the end of the recordset if the value is FORWARD. An unsuccessful search stops at the start of the recordset if the value is BACKWARD.
bmkStart A Variant bookmark that functions as the starting position for the search.

© 1999 Microsoft Corporation. All rights reserved. Terms of use.