Condividi tramite


dbc_CloseData Event

Occurs when a database closes.

PROCEDURE dbc_CloseData(cDatabaseName, lAll) 

-Or-

PROCEDURE dbc_CloseData
LPARAMETERS cDatabaseName, lAll

Parameters

  • cDatabaseName
    Specifies the name of the target database.
  • lAll
    Specifies whether the ALL keyword was included in the CLOSE DATABASES command. If DBC Events is turned on, this event occurs whenever a database is closed whether or not it is closed explicitly with the CLOSE DATABASES command.

Remarks

You can use the dbc_CloseData event to verify appropriate values for cDatabaseName and lAll or use those parameters in a procedure to track access to the database when the database is about to be closed

When several databases are closed at one time, the dbc_CloseData method for each database is fired in turn. Therefore, if you issue the CLOSE DATABASES ALL command, several different CloseData events occur and several different dbc_CloseData methods can be executed.

Return .F. from this procedure to prevent the database from being closed.

Example

PROCEDURE dbc_CloseData ;
         (cDatabaseName,;
          lAll)
? '     cDatabaseName = ' + TRANSFORM(cDatabaseName) + ' - ' ;
                      + TYPE('cDatabaseName')
? '     lAll          = ' + TRANSFORM(lAll)          + ' - ' ;
                      + TYPE('lAll')+' /end/ '
RETURN .F.     && This will prevent database closure.
ENDPROC

See Also

Enable or Disable DBC Events | dbc_BeforeAddTable Event | dbc_Activate Event