Condividi tramite


ADATABASES( ) Function

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

ADATABASES(ArrayName)

Return Values

Numeric

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.

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.

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

CREATE DATABASE | DISPLAY DATABASE | LIST DATABASE | MODIFY DATABASE | OPEN DATABASE