Click or drag to resize

DbUseArea Function

Open a database file.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.10
Syntax
 FUNCTION DbUseArea(
	 lNewArea AS USUAL,
	 cDriver AS USUAL,
	 cDataFile AS USUAL,
	 cAlias AS USUAL,
	 lShared AS USUAL,
	 lReadOnly AS USUAL,
	 aStruct AS USUAL,
	 cDelim AS USUAL,
	 acRDDs AS USUAL
) AS LOGIC
View Source

Parameters

lNewArea
Type: Usual
Specifies whether the file is to be opened in a new work area.  TRUE selects the lowest numbered unoccupied work area as the current work area before the use operation.  If <lNewArea> is FALSE or omitted, the current work area is used (if the work area is occupied, it is closed first).
cDriver
Type: Usual
The name of the RDD that will service the work area.  If not specified, the default RDD as determined by RDDSetDefault() is used.
cDataFile
Type: Usual
The name of the database file to open, including an optional drive, directory, and extension.  If the database file has a corresponding memo file, it is also opened.  The default extension for database and memo files is determined by the RDD.
If the database file or its corresponding memo file does not exist, a runtime error is raised.  See SetDefault() and SetPath() for file searching and creation rules.
cAlias
Type: Usual
An identifier name to associate with the work area when <cDataFile> is opened.  If not specified, the alias defaults to the database file name.  Duplicate alias names are not allowed within a single application.
lShared
Type: Usual
TRUE attempts to open <cDataFile> for shared use.  FALSE attempts to open <xcDataFile> for exclusive (non-shared) use, denying all other processes access until the database file is closed.If <lShared> is omitted, the current SetExclusive() setting determines whether shared access is allowed.  However, it is highly recommended that you specify the open mode as part of the USE command rather than relying on SetExclusive() to determine it for you.
lReadOnly
Type: Usual
TRUE attempts to open <cDataFile> with a read-only attribute, prohibiting updates to the work area.  FALSE attempts to open <cDataFile> with a read-write attribute, allowing updates.  If <lReadOnly> is omitted, the default value is FALSE.  If <cDataFile> cannot be accessed using the indicated attribute, a runtime error is raised.
aStruct
Type: Usual
An array containing field descriptions in the format returned by DBStruct().
This argument does not apply to DBF files.  It is intended for use with file formats that do not store field descriptions.  For example, if you use an RDD that supports SDF or delimited files, you can use this argument to define the file structure, which can then be used with other commands or functions to access the field descriptions.  Here is an example of this argument:
{"First", "C", 35, 0};

{"Last", "C", 35, 0};

{"Birthday", "D", 8, 0}}

? First                                        // Return: Josie
cDelim
Type: Usual
The delimiter for fields within a delimited database file.  If you are using one of the supplied RDDs for processing .DBF files (see the "RDD Specifics" appendix in the Programmer's Guide for a complete list), the delimiter should be a NULL_STRING, which is the default if the argument is omitted.
acRDDs
Type: Usual
A one-dimensional array with the names of RDDs from which the main RDD inherits special functionality.  This allows you to use RDDs with special capabilities, like encryption or decryption, in different work areas with different database drivers.  These RDDs overlay special functions of the main RDD (specified with the <cDriver> argument).  If multiple RDDs (specified with this argument) implement the same function, the function associated with the last RDD in the list takes precedence.  If <aRDDs> is omitted, no additional RDDs are assumed.

Return Value

Type: Boolean
TRUE if successful; otherwise, FALSE.
Remarks
DBUseArea() is a functional equivalent of the USE command.  For more information, refer to the USE command.
Examples
This example is a typical use of the DBUseArea() function:
X#
DBUseArea(TRUE, "DBFMDX", "employees")
See Also