OpenData, CloseData, Activate, Deactivate, ModifyData
These database events fire when a database is opened, closed, made the current database, made non-current, or displayed in the Database Designer, respectively.
Usage |
PROCEDURE DBC_OpenData( cDatabaseName, lExclusive, lNoUpdate, lValidate ) PROCEDURE DBC_CloseData( cDatabaseName, lAll ) PROCEDURE DBC_Activate( cDatabaseName ) PROCEDURE DBC_Deactivate( cDatabaseName ) PROCEDURE DBC_ModifyData( cDatabaseName, lNoWait, lNoEdit ) |
Parameter |
Value |
Meaning |
cDatabaseName |
Character |
The name of the database being opened, closed, modified, activated, or deactivated. |
lExclusive |
.T. |
The database is being opened exclusively, either because the EXCLUSIVE clause was used or because SET EXCLUSIVE is set to ON. |
.F. |
The database is being opened for shared access. |
|
lNoUpdate |
Logical |
Indicates whether the NOUPDATE clause was specified. |
lValidate |
Logical |
Indicates whether the VALIDATE clause was used. |
lAll |
Logical |
Indicates whether the ALL clause was specified in the CLOSE DATABASES command. |
lNoWait |
Logical |
Indicates whether the NOWAIT clause was specified. |
lNoEdit |
Logical |
Indicates whether the NOEDIT clause was used. |
Just because lNoUpdate is .F. doesn't mean the database is updateable; it may be marked as read-only at the operating system level. Use ISREADONLY(0) (added in VFP 7) to determine if the database can be updated. |
Example |
* This goes in the stored procedures of a database. PROCEDURE DBC_OpenData(cDatabaseName, lExclusive, lNoupdate, ; lValidate) WAIT WINDOW PROGRAM() + CHR(13) + ; 'cDatabaseName: ' + cDatabaseName + CHR(13) + ; 'lExclusive: ' + TRANSFORM(lExclusive) + CHR(13) + ; 'lNoUpdate: ' + TRANSFORM(lNoUpdate) + CHR(13) + ; 'lValidate: ' + TRANSFORM(lValidate) + CHR(13) + ; 'DBC(): ' + DBC() PROCEDURE DBC_CloseData(cDatabaseName, lAll) WAIT WINDOW PROGRAM() + CHR(13) + ; 'cDatabaseName: ' + cDatabaseName + CHR(13) + ; 'lAll: ' + TRANSFORM(lAll) PROCEDURE DBC_Activate(cDatabaseName) WAIT WINDOW PROGRAM() + CHR(13) + ; 'cDatabaseName: ' + cDatabaseName + CHR(13) + ; 'DBC(): ' + DBC() PROCEDURE DBC_Deactivate(cDatabaseName) WAIT WINDOW PROGRAM() + CHR(13) + ; 'cDatabaseName: ' + cDatabaseName + CHR(13) + ; 'DBC(): ' + DBC() PROCEDURE DBC_ModifyData(cDatabaseName, lNoWait, lNoEdit) WAIT WINDOW PROGRAM() + CHR(13) + ; 'cDatabaseName: ' + cDatabaseName + CHR(13) + ; 'lNoWait: ' + TRANSFORM(lNoWait) + CHR(13) + ; 'lNoEdit: ' + TRANSFORM(lNoEdit) * End of stored procedures. * Open a database, change what's current, modify it, * then close it. OPEN DATABASE TestData SET DATABASE TO SET DATABASE TO TestData MODIFY DATABASE CLOSE DATABASE |
See Also |
Close All, Close Databases, Compile Database, Database Events, DBC(), IsReadOnly(), Modify Database, Open Database, Set Database, Set Exclusive, Validate Database |