xHarbour Reference Documentation > Command Reference xHarbour Developers Network  

SELECT

Changes the current work area.

Syntax

SELECT <nWorkArea> | <cAliasName>

Arguments

<nWorkArea>
This is a numeric value between 0 and 65535. It specifies the number of the work area to become the current one. All database commands and unaliased functions are executed in the current work area.

The value 0 has a special meaning: it selects the next unused work area disregarding its work area number.

<cAliasName>
This is the symbolic alias name of a used work area. The alias name is specified with the USE command.

Note:  both work area number or alias name can be specified as literal value or as expression enclosed in parentheses.

Description

The SELECT command is used to select the current work area. A work area is a logical entity where database files are open along with their accompanying files, like memo or index files. The maximum number of work areas is restricted to 65535.

Work areas can be selected using their numeric identifier. When a work area is occupied by an open database, it can be selected using the alias name specified with the USE command. The alias name is a powerful means for executing expressions in a work area that is not the current one. All that is required is to enclose an expression in parentheses and prefix it with the alias name and alias operator.

Info

See also:Alias(), DbSelectArea(), Select(), SET INDEX, USE, Used()
Category: Database commands
Source:rdd\dbcmd.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example demonstrates how different operatations can be coded
// for multiple work areas.

   PROCEDURE Main
      SELECT 1
      USE Customer ALIAS Cust
      ? Select()                       // result: 1

      USE Invoice ALIAS Inv NEW
      ? Select()                       // result: 2

      USE Sales NEW
      ? Select()                       // result: 3

      SELECT Cust
      ? LastRec()                      // result: 200
      ? Inv->(LastRec())               // result: 369

      CLOSE ALL
   RETURN

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