| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Retrieves the number of the current record in a work area.
RecNo() --> nRecord
The function returns a numeric value which is the record number of the current record in a work area. If no database is open in the work area, RecNo() returns zero.
RecNo() retrieves the record number of the current record in a work area. The record number identifies a database record unambiguously and can be used with the DbGoto() function to navigate the record pointer of a work area to a particular record.
Record numbers can be used for physical navigation in a database, they do not represent the logical order of records in an indexed database.
| See also: | Bof(), DbGoto(), DbInfo(), DbSkip(), Eof(), GO, LastRec(), OrdKeyGoto(), RecSize(), SKIP |
| Category: | Database functions |
| Source: | rdd\dbcmd.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example outlines the difference between physical and logical
// records.
REQUEST Dbfcdx
PROCEDURE Main
USE Customer VIA "DBFCDX"
INDEX ON Upper(LastName) TAG NAME TO Cust01
DbGoto( 1 ) // Physical first record
? Lastname, Recno() // result: Miller 1
DbGoto( LastRec() ) // Physical last record
? Lastname, Recno() // result: Smith 22
OrdKeyGoto( 1 ) // Logical first record
? Lastname, Recno() // result: Alberts 20
OrdKeyGoto( LastRec() ) // Logical last record
? Lastname, Recno() // result: Waters 15
USE
RETURN
http://www.xHarbour.com