Note | This command is defined in a header file and will be preprocessed by the X# preprocessor to a function call. If you disable the standard header (-nostddefs) files then this command will not be available. If you tell the compiler to use a different standard header file (-stddef ) then this command may also be not available |
Change the current work area.
SELECT <xnWorkArea> | <xcAlias>
<xnWorkArea> | A number from 0 to 250 that specifies the work area to select. |
<xcAlias> | The alias identifier for the work area to select. If there is no open database file associated with the specified alias, a runtime error is raised. |
SELECT causes the specified work area to become the current work area. All subsequent database operations will apply to this work area unless another work area is explicitly specified for an operation.
SELECT is functionally equivalent to DBSelectArea().
Selecting 0: | Selecting work area 0 causes the lowest numbered unoccupied work area to become the current work area. Using SELECT 0 before opening a file is equivalent to USE with the NEW option. |
Aliased expressions: | The alias operator (->) can temporarily select a work area while an expression is evaluated and automatically restore the previously selected work area afterward. |
This example opens a series of database files by selecting each work area by number, then using each database file in that work area:
SELECT 1
USE customer
SELECT 2
USE invoices
SELECT 3
USE parts
SELECT customer
To make your code independent of the work area number used, a better method is to open each database in the next available work area by specifying the NEW clause on the USE command line. In this example USE...NEW is employed instead of SELECT 0, then USE:
USE customer NEW
USE invoices NEW
SELECT customer
This code fragment changes work areas while saving the current work area name to a variable by using the Select() function. After executing an operation for the new work area, the original work area is restored:
nLastArea := Select()
USE newfile NEW
<Statements>...
SELECT (nLastArea)s
XSharp.RT.DLL
Alias(), DbSelectArea(), Select(), USE, Used()