Click or drag to resize

DbUseArea Function

X#
Open a database file.

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

Parameters

lNewArea (Optional)
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 (Optional)
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 (Optional)
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 (Optional)
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 (Optional)
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 (Optional)
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 (Optional)
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:
X#
1{"First", "C", 35, 0};<br />
2
3{"Last", "C", 35, 0};<br />
4
5{"Birthday", "D", 8, 0}}<br />
6
7? First                    // Return: Josie
cDelim (Optional)
Type: Usual
The delimiter for fields within a delimited database file.
If you are using one of the supplied RDDs for processing .DBF files , the delimiter should be a NULL_STRING, which is the default if the argument is omitted.
acRDDs (Optional)
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 acRDDs is omitted, no additional RDDs are assumed.

Return Value

Type: Logic
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#
1DBUseArea(TRUE, "DBFMDX", "employees")
See Also