Condividi tramite


Adding Code to a DBC Event

You can add method code to a DBC event in a program file or to the stored procedures file of your database. If you set DBC events to On in your database, the database becomes incompatible with earlier versions of Visual FoxPro. To regain compatibility with earlier versions of Visual FoxPro, set DBC Events to Off.

When you use the Database Properties dialog box to add code to DBC events, Visual FoxPro inserts a Procedure template for each selected DBC event in the procedure file so you can immediately add your code.

To add code to a DBC Event

  1. In an open database, from the Database or the Shortcut menu, select Properties.

  2. From the Event or Code Name list, select an event.

    You can select multiple events by holding the control or shift keys as you make your selections.

  3. If you want to place the code in a stored procedure in the current database, click Edit Code.

    -or-

    If you want to place the code in an external file, select Set Events On, click Events File, specify or select the file you want to edit, and click Edit Code.

The editor opens in the procedures file, so you can add code to the DBC event method template(s) added by Visual FoxPro.

See Also

Database Container Events | Enabling or Disabling DBC Events | Using DBC Events