共用方式為


INDBC( ) Function

Returns true (.T.) if the specified database object is in the current database; otherwise returns false (.F.).

INDBC(cDatabaseObjectName, cType)

Return Values

Logical

Parameters

  • cDatabaseObjectName
    Specifies the name of a named connection, field, index, table, or SQL view for which INDBC( ) returns a logical value indicating whether or not the object is in the current database.

  • cType
    Specifies the database object type of cDatabaseObjectName. The following table lists the values for cType and the corresponding database object type.

    cType Database object type
    CONNECTION Named connection
    FIELD Field
    INDEX Index
    TABLE Table
    VIEW SQL View

    The CONNECTION, FIELD, INDEX, TABLE, and VIEW settings cannot be abbreviated.

Remarks

A database must be open and current when INDBC( ) is issued; otherwise Visual FoxPro generates an error message.

Example

In the following example, a temporary database named mydbc is created, and a temporary table named mytable is added to the database. INDBC( ) is used to determine if the new table is in the database. The database and table are closed and erased.

CLOSE DATABASES
CREATE DATABASE mydbc  && Creates a new database
CREATE TABLE mytable (field1 C(10)) && Automatically added to database

? 'MyTable in the database? '
?? INDBC('mytable', 'TABLE')  && Returns .T.

CLOSE DATABASES
DELETE DATABASE mydbc DELETETABLES

See Also

ADBOBJECTS( ) | CREATE DATABASE | DELETE DATABASE | OPEN DATABASE | SET DATABASE