Condividi tramite


ISREADONLY( ) Function

Determines whether a table or database is opened read-only.

ISREADONLY([nWorkArea | cTableAlias])

Return Values

Logical

Parameters

  • nWorkArea | cTableAlias
    Returns the read-only status for a table open in another work area. nWorkArea specifies the work area number and cTableAlias specifies the table or work area alias. ISREADONLY( ) returns false (.F.) if a table isn't open in the work area you specify.

    If you don't specify a work area number or a table or work area alias, the ISREADONLY( ) function returns the read-only status of the table open in the current work area.

    ISREADONLY(0) returns the status of the current database. If there is no current open database, ISREADONLY(0) returns an error.

Remarks

ISREADONLY( ) returns true (.T.) if a table is opened read-only; otherwise, ISREADONLY( ) returns false (.F.).

You can open a table read-only by including the NOUPDATE option when opening the table with USE, by checking the Read Only check box when opening the table from the Open dialog box, or by assigning MS-DOS read-only attributes to the table.

You cannot pass a non-current database alias to the ISREADONLY( ) function. To ensure that a database is present, you can use code such as the following:

!EMPTY(DBC())

A cursor created with the SELECT – SQL command is always read-only.

Example

CLOSE DATABASES
OPEN DATABASE (HOME(2) + 'data\testdata')
USE customer    NOUPDATE  && Open customer table read-only

CLEAR
? ISREADONLY('customer')  && Returns .T.

See Also

USE | ReadOnly Property | SELECT - SQL Command