VoDbUseArea Function (Logic, Type, String, String, Logic, Logic) | |
Open a database file.
Namespace:
XSharp.RT
Assembly:
XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax FUNCTION VoDbUseArea(
lNewArea AS LOGIC,
rddType AS Type,
cDataFile AS STRING,
cAlias AS STRING,
lShared AS LOGIC,
lReadOnly AS LOGIC
) AS LOGIC
public static bool VoDbUseArea(
bool lNewArea,
Type rddType,
string cDataFile,
string cAlias,
bool lShared,
bool lReadOnly
)
Request Example
View SourceParameters
- lNewArea
- Type: Logic
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). - rddType
- Type: Type
Type 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: Logic
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: Logic
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:
Logic
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:
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