Determines whether a table or database is opened read-only.
ISREADONLY([nWorkArea | cTableAlias]) |
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.
Return Value
Logical
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:
В | Copy Code |
---|---|
!EMPTY(DBC()) |
A cursor created with the SELECT – SQL command is always read-only.
Example
В | Copy Code |
---|---|
CLOSE DATABASES OPEN DATABASE (HOME(2) + 'data\testdata') USE customer NOUPDATE && Open customer table read-only CLEAR ? ISREADONLY('customer') && Returns .T. |