Click or drag to resize

ADatabases Function

X#
Places the names of all open databases and their paths into a variable array.

Namespace:  XSharp.VFP
Assembly:  XSharp.VFP (in XSharp.VFP.dll) Version: 2.19
Syntax
 FUNCTION ADatabases(
	ArrayName AS ARRAY
) AS DWORD
Request Example View Source

Parameters

ArrayName
Type: Array
Specifies the name of the array.

Return Value

Type: DWord
Numeric
Remarks
The names of all open databases are placed into a variable array.

If the array you specify doesn't exist, X# automatically creates the array. If the array exists and isn't large enough to contain all the database information, X# automatically increases the size of the array to accommodate the information. If the array is larger than necessary, X# truncates the array. If the array exists and ADatabases( ) returns 0 because no databases are open, an existing array remains unchanged. If the array doesn't exist, and ADatabases( ) returns 0, the array is not created.

ADatabases( ) creates a two-dimensional array. The first column of the array contains the names of the open databases, and the second column contains the paths to the databases.
ADatabases( ) returns the number of database names (rows) in the array. If no databases are open, ADatabases( ) returns 0 and the array isn't created.
Examples
X#
1Set PATH TO (HOME(2) + 'data\')     // Sets path to database
2Open Database testdata // Opens the database
3Clear
4? ADatabases(gaDatabase)     // Creates an array of open databases
5Display MEMORY LIKE gadatabase  // Displays the contents of the array
6Close Databases
See Also