Show/Hide Toolbars

XSharp

NoteThis command is defined in a header file and will be preprocessed by the X# preprocessor to a function call. If you disable the standard header (-nostddefs) files then this command will not be available. If you tell the compiler to use a different standard header file (-stddef ) then this command may also be not available

Purpose

Search an order for the first key matching the specified expression, position the record pointer to the corresponding record, and set the Found() flag.

Syntax

SEEK <uKeyValue> [SOFTSEEK] [LAST]  [[IN|ALIAS] <workarea>]

Arguments

<uKeyValue>An expression to match with an order key value.

 

SOFTSEEKIf SOFTSEEK is specified (or if SetSoftSeek() is TRUE), the record pointer is positioned to the record with the next higher key value, and Found() returns FALSE after an unsuccessful SEEK. EoF() returns TRUE only if there are no keys in the order greater than <uKeyValue>.
 
If SOFTSEEK is not specified and SetSoftSeek() is FALSE, the record pointer is positioned to LastRec() + 1, EOF() returns TRUE, and Found() returns FALSE after an unsuccessful SEEK.

 

LASTIf LAST is specified, SEEK finds the last occurrence of the specified key value.  If LAST is not specified, SEEK finds the first occurrence.

 

IN|ALIAS <workarea>Specifies the work area for which the operation must be performed

Description

If the SEEK is successful, Found() is set to TRUE and the record pointer is positioned to the matching record.

Examples

The following example searches for "Doe" using the SEEK command:

 

USE customer NEW
SET INDEX TO customer
SEEK "Doe"
 
IF Found()
 .
 .  <Statements>
 .
ENDIF

 

The following example performs a soft seek for "Doe" using SOFTSEEK clause of the SEEK command.  Note that the SOFTSEEK clause does not have any effect of the SetSoftSeek() flag:

 

USE customer NEW
SET INDEX TO customer
 
? SetSoftSeek()                        // FALSE
SEEK "Doe" SOFTSEEK
? SetSoftSeek()                        // Still FALSE
 
IF !Found()
 ? Customer->Name                // Returns next logical
                                                 // name after "Doe"
ENDIF

Assembly

XSharp.RT.DLL

See Also

DbSeek(), DbSetIndex(), DbSetOrder(), SET INDEX, SET ORDER