Compartir a través de


How to: Enable or Disable DBC Events

Before you can add procedure code to Database Container (DBC) events, you need to activate them. When you do not want to execute code in DBC events, you can deactivate them.

Warning

DBC events are not available in versions prior to Visual FoxPro 7.0. Therefore, activating DBC events makes the database incompatible with versions prior to Visual FoxPro 7.0. Attempting to access a DBC events-enabled database using a version prior to Visual FoxPro 7.0 generates an error.

To activate DBC events

  1. Open database in the Database Designer.

  2. On the Database menu, click Properties.

  3. In the Database Properties dialog box, click Set Events On.

  4. Click OK.

For more information, see Database Properties Dialog Box.

To activate DBC events programmatically

  1. Make sure the database is open as the current database.

  2. Use the DBSETPROP( ) function.

For example, the following code activates DBC events:

DBSETPROP(cDBCName,'Database','DBCEvents',.T.)

For more information, see DBSETPROP( ) Function.

To deactivate DBC events

  1. Open database in the Database Designer.

  2. On the Database menu, click Properties.

  3. In the Database Properties dialog box, clear Set Events On.

  4. Click OK.

For more information, see Database Properties Dialog Box.

To deactivate DBC events programmatically

  • Use the DBSETPROP( ) function.

For example, the following code deactivates DBC events:

DBSETPROP(cDBCName,'Database','DBCEvents',.F.)

See Also

Tasks

How to: Add Code to a DBC Event

Reference

Database Container Events

Other Resources

Working with Database Container Events