ADATABASES( ) Function

JavaScript Editor js editor     Web development 



Main Page

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

ADATABASES(ArrayName)

Parameters

ArrayName


Specifies the name of the array. If the array you specify doesn't exist, Visual FoxPro automatically creates the array. If the array exists and isn't large enough to contain all the database information, Visual FoxPro automatically increases the size of the array to accommodate the information. If the array is larger than necessary, Visual FoxPro 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.

Return Value

Numeric

Remarks

The names of all open databases are placed into a variable array.

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.

Example

The following example opens the testdata database, and then uses ADATABASES(В ) to create an array named gaDatabase containing the names of all open databases.

В Copy Code
SET PATH TO (HOME(2) + 'data\')     && Sets path to database
OPEN DATABASE testdata && Opens the database
CLEAR
? ADATABASES(gaDatabase)     && Creates an array of open databases
DISPLAY MEMORY LIKE gadatabase  && Displays the contents of the array
CLOSE DATABASES

See Also



JavaScript Editor js editor     Web development