dbc_BeforeDropTable Event
Occurs before the specified table is removed from the active database and deleted from disk with the DROP TABLE command. There are two versions of the syntax.
PROCEDURE dbc_BeforeDropTable(cTableName, lRecycle)
PROCEDURE dbc_BeforeDropTable
LPARAMETERS cTableName, lRecycle
Parameters
cTableName
Specifies the table being removed from the current database and deleted from disk.lRecycle
Specifies whether the table is to be placed in the Microsoft Windows Recycle Bin rather than immediately deleted from the disk. Some data, such as the table properties available only in tables contained in a database, are lost even if the table is only recycled rather than removed and deleted.
Remarks
You can use the dbc_BeforeDropTable event to verify an appropriate value for cTableName, and use those parameters in a procedure to track, or manage access to the database before the table is removed from the database and the disk.
If you delete a table by using DELETE FILE or the operating system, no event occurs.
Return .F. from this procedure to prevent the table from being dropped.
Example
* Reports the name of the method, where it came from and what the
* parameter values were.
PROCEDURE dbc_BeforeDropTable ;
(cTableName, ;
lRecycle)
? '>> ' + PROGRAM()
?? ' in ' + SUBSTR(SYS(16),RAT('\',SYS(16))+1)
? ' cTableName = ' + TRANSFORM(cTableName) + ' - ' ;
+ TYPE('cTableName ')
? ' lRecycle = ' + TRANSFORM(lRecycle) + ' - ' ;
+ TYPE('lRecycle')+' /end/ '
ENDPROC
See Also
Tasks
How to: Enable or Disable DBC Events