You are on page 1of 2

Find and Seek Command: - The find and seek command can

help us to find information with the help of index file very


efficiently. If the database file is indexed on a field that
contains the information to be searched, foxpro locates it
within no time. It does not matter whether the file contains a
few records or thousands of records. To use FIND, we must
open the database file with the corresponding index file.
e.g:- use student 
index on name to mname 
Find Mohan 
Unlike other commands we do not need to enclose the
character search string within quotation marks (“ “). After
giving the above command we may not notice anything
special on the screen, but FoxPro has located the record with
Mohan in the Name field. FoxPro will display the record
number of record in the status bar. To show the record we
should use display command. When we use find command, if
FoxPro does not find the information in the database, it
displays a message, “no find”. The FIND command locates the
first record that meets the specified search string. The
database file may have more records with this search string.
After we have found the first record we can use list with
WHILE to display all records that contains the specified
search string.
e.g:- list while name= “Mohan” 
When we use the FIND command to locate the information,
we should keep the following points in our mind:-
 We can search for data only on the active index field.
That is if the index file on name field we can not search
on roll field.
 We must enter the search string exactly in the same way
as is entered in the index field into the database.
 Do not use extra space within words.
 By default, FoxPro tries to match only entered search
string, but it is not matter that after how many
characters in the search filed after search string.
However if we want FoxPro to exactly match the search
string with the database field, we can use “set exact on”
command.
The SEEK command is similar to find command. It is also
used for same purpose that is to search for information in
an indexed database field. The only difference between
the FIND and SEEK command that SEEK can search for
contents of an expression or variable whereas FIND
requires the search string to be entered directly.
e.g:- use student 
index on name to mm
store 10 to r 
seek r 

You might also like