xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

DbGoto()

Positions the record pointer on a particular record.

Syntax

DbGoto( <xRecno> ) --> NIL

Arguments

<xRecno>
The parameter identifies a single record in a database. For DBF files, this is the numeric record number, as returned by Recno() for a particular record.

Return

The return value is always NIL.

Description

The DbGoto() function moves the record pointer to the record identified with <xRecno>. This position is independent of any index or filter currently active in the work area, i.e. <xRecno> does not change with the logical order of records but identifies records physically.

Issuing a DbGoto( Recno() ) call in a network enviroment will refresh the database and index buffers. This is the same as a DbSkip(0) call. The parameter <xRecno> may be something other than a record number, depending on the RDD used. In some data formats, for example, the value of <xRecno> is a unique primary key, while in other formats, <xRecno> could be an array offset if the data set was an array.

If the record <xRecno> does not exist in the work area, the record pointer is positioned on the "ghost record" (Lastrec()+1), and both, BoF() and Eof(), are set to .T. (true).

Info

See also:Bof(), DbGoBottom(), DbGoTop(), DbSeek(), DbSkip(), Eof(), GO, OrdKeyGoTo()
Category: Database functions
Source:rdd\dbcmd.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example physically moves the record pointer and outlines
// some important state variables of a work area.

   PROCEDURE Main
      USE Customer

      ? Recno(), LastRec()             // result:   1   225

      DbGoto(10)
      ? Recno(), LastRec()             // result:  10   225

      DbGoto(1000)
      ? Recno(), Bof(), Eof()          // result: 226   .T. .T.

      DbGoto(-1)
      ? Recno(), Bof(), Eof()          // result: 226   .T. .T.

      USE
   RETURN

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