xHarbour Reference Documentation > Function Reference |
Selects the current work area.
DbSelectArea( <cAlias> | <nWorkArea> ) --> NIL
The return value is always NIL.
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.
See also: | DbUseArea(), SELECT, Select(), USE, Used() |
Category: | Database functions |
Source: | rdd\dbcmd.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// 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
http://www.xHarbour.com