Click or drag to resize

VoDbUseArea Function (Boolean, String, String, String, Boolean, Boolean)

Open a database file.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.4a
Syntax
 FUNCTION VoDbUseArea(
	lNewArea AS LOGIC,
	rddName AS STRING,
	cDataFile AS STRING,
	cAlias AS STRING,
	lShared AS LOGIC,
	lReadOnly AS LOGIC
) AS LOGIC
View Source

Parameters

lNewArea
Type: Boolean
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.  FALSE uses the current work area (if the work area is occupied, it is closed first).
rddName
Type: String
Name of the RDD to use.
cDataFile
Type: String
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.  See SetDefault() and SetPath() for file searching and creation rules.
cAlias
Type: String
An identifier name to associate with the work area when <cDataFile> is opened.  Duplicate alias names are not allowed within a single application.
lShared
Type: Boolean
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.
lReadOnly
Type: Boolean
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.

Return Value

Type: Boolean
TRUE if successful; otherwise, FALSE.
Remarks
VODBUseArea() is a strongly typed function used to implement DBUseArea().
This function does not call the error handler and will not, therefore, produce a runtime error message or create an error object if it fails.  Thus, it may be important to check the return value to determine if the function succeeded.
The global structure, StrucErrInfo, will contain needed information regarding any error that occurs.  See DBUseArea() for more information.
Examples
This example is a typical use of the VODBUseArea() function:
X#
 1FUNCTION NtxUse(cDBF AS STRING) AS LOGIC PASCAL
 2    LOCAL n,i           AS DWORD
 3    LOCAL rddList       AS _RDDLIST
 4    LOCAL aRdds         AS ARRAY
 5    LOCAL lRet        <br />
 6AS LOGIC
 7    aRdds := {"CAVODBF", "DBFNTX"}
 8    n       := ALen(aRdds)
 9    rddList := MemAlloc( (_SizeOf(DWORD)) + (n * _SizeOf(SYMBOL)) )
10    rddList.uiRddCount := n
11    FOR i := 1 TO n
12        rddList.atomRddName[i] := SysAddAtomUpperA(aRdds[i])
13    NEXT
14    lRet := VODBUseArea(TRUE, rddList, cDBF, "", TRUE, FALSE)
15    MemFree(rddList)
16    RETURN lRet
See Also