Condividi tramite


DBF( ) Function

Returns the name of a table open in a specified work area or a table name from a table alias.

DBF([cTableAlias | nWorkArea])

Return Values

Character

Parameters

  • cTableAlias
    Specifies the table alias.

  • nWorkArea
    Specifies the work area number.

    If you omit cTableAlias and nWorkArea, DBF( ) returns the name of the table open in the current work area. DBF( ) returns an empty string if a table isn't open in the work area you specify. If a table doesn't have the alias you specify with cTableAlias, Visual FoxPro generates an error message.

    For information on creating an alias for a table, see USE.

Remarks

When SET FULLPATH is ON, DBF( ) returns the path to the table with the table name. When SET FULLPATH is OFF, DBF( ) returns the drive on which the table resides with the table name.

Example

The following example returns the name of a table from its work area and its alias, and returns the empty string after all tables have been closed.

CLOSE DATABASES
OPEN DATABASE (HOME(2) + 'Data\testdata')
USE customer IN 2 ALIAS mycust
CLEAR
? DBF(2)  && Displays customer.dbf with its path
? DBF('mycust')  && Displays customer.dbf with its path
CLOSE DATABASES
? DBF( )      && Displays the empty string

See Also

CDX( ) | FIELD( ) | NDX( ) | SET FULLPATH | USE