Click or drag to resize

DbCloseArea Function

X#
Close all files in a work area.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax
 FUNCTION DbCloseArea() AS LOGIC
Request Example View Source

Return Value

Type: Logic
TRUE if successful; otherwise, FALSE.
Remarks
DBCloseArea() releases a work area from use.
By default, this function operates on the currently selected work area.
It can be made to operate on an unselected work area by specifying it within an aliased expression or by calling the overload that accepts a workarea parameter (a workarea number or alias ).
DBCloseArea() is equivalent to the CLOSE command or the USE command with no clauses.
For more information, refer to the USE and CLOSE commands.
Examples
The following example closes a file via an alias reference:
X#
 1cLast := "Winston"
 2DBUseArea(TRUE, "DBFNTX", "sales", "Sales", TRUE)
 3Sales->DBSetIndex("salefnam")
 4Sales->DBSetIndex("salelnam")
 5DBUseArea(TRUE, "DBFNTX", "colls", "Colls", TRUE)
 6Colls->DBSetIndex("collfnam")
 7Colls->DBSetIndex("colllnam")
 8// Select "Sales" work area
 9IF Sales->DBSeek(cLast)
10    IF Sales->Deleted() .AND. ;
11        Sales->RLock()
12        QOut("Record deleted: ", Sales->Deleted())
13    ENDIF
14ELSE
15    QOut("Not found")
16    Colls->DBCloseArea()
17ENDIF
See Also