xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

DbSelectArea()

Selects the current work area.

Syntax

DbSelectArea( <cAlias> | <nWorkArea> ) --> NIL

Arguments

<cAlias>
A character string holding the alias name of the work area to select as current.
<nWorkArea>
The numeric ordinal position of the work area to select. Work areas are numbered from 1 to 65535. The value 0 has a special meaning: it selects the next unused work area, irrespective of its ordinal number.

Return

The return value is always NIL.

Description

DbSelectArea() selects the current work area. The scope of all database commands and all unaliased database functions is the current work area. A work area can be thought of as the place where databases and accompanying files are open and become accessible. One work area can hold one open database. To operate with multiple open databases at a time requires an application to switch between work areas using DbSelectArea().

An alternative is given by aliased expressions that are prefixed with the alias name or work area number of the work area to select temporarily before executing a database function. Note that aliased expressions are only possible with database functions. Database commands operate always in the current work area.

Info

See also:DbUseArea(), SELECT, Select(), USE, Used()
Category: Database functions
Source:rdd\dbcmd.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example opens two databases in two different work areas
// and outlines aliased expressions.

   PROCEDURE Main
      USE Customer ALIAS Cust

      DbSelectArea(10)
      USE Invoice ALIAS Inv

      ? Select()                       // result: 10
      ? Cust->( Select() )             // result:  1

      DbSelectArea(0)
      ? Select()                       // result:  2

      ? (10)->( Alias() )              // result: INV
      CLOSE ALL
   RETURN

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