Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

BeforeDropView, AfterDropView

These Database Events fire when a view is removed from a database, whether programmatically using the DELETE VIEW or DROP VIEW commands, or visually using the Database Designer.

Usage

PROCEDURE DBC_BeforeDropView( cViewName )

PROCEDURE DBC_AfterDropView( cViewName )

Parameter

Value

Meaning

cViewName

Character

The name of the view.

As with other before-and-after pairs of events, you can prevent a view from being removed by returning .F. in the BeforeDropView event, while the AfterDropView event is simply notified that a view was removed.

Example

* This goes in the stored procedures for a database.

PROCEDURE DBC_BeforeDropView(cViewName)
WAIT WINDOW PROGRAM() + CHR(13) + ;
    'cViewName: ' + cViewName

PROCEDURE DBC_AfterDropView(cViewName)
WAIT WINDOW PROGRAM() + CHR(13) + ;
    'cViewName: ' + cViewName

* End of stored procedures.
* Create a view, and then remove it.

CREATE SQL VIEW TestView AS SELECT * FROM CUSTOMER
DROP VIEW TestView

See Also

BeforeCreateView, Create SQL View, Database Events, Delete View, Drop View