xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

RecNo()

Retrieves the number of the current record in a work area.

Syntax

RecNo() --> nRecord

Return

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.

Description

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.

Info

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

Example

// 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

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe