Condividi tramite


dbc_BeforeDBSetProp Event

Occurs before DBSetProp( ) runs.

PROCEDURE dbc_BeforeDBSetProp(cName, cType, cProperty, ePropertyValue) 

-or-

PROCEDURE dbc_BeforeDBSetProp
LPARAMETERS cName, cType, cProperty, ePropertyValue
  • cName
    Specifies the value of the first parameter in the DBGetProp( ) function, the name of the database, field, named connection, table, or view for which DBSETPROP( ) changes the value.
  • cType
    Specifies the value of the second parameter in the DBSetProp( ) function, the object type of the item named in cName.
  • cProperty
    Specifies the value of the third parameter in the DBSetProp( ) function, the property for which DBSETPROP( ) changes the value.
  • ePropertyValue
    Specifies the value of the fourth parameter in the DBSetProp( ) function, the value to be assigned to the property in cProperty.

For details on valid cType and cProperty values, see DBSETPROP( ) and DBGETPROP( ) in Help.

Remarks

You can use the dbc_BeforeDBSetProp event to track attempted access to the database before DBSETPROP( ) runs.

Return .F. from this procedure to prevent the property value from being set. This will cause the DBSetProp() function to return .F..

Some property values can be changed using DBSetProp( ) or using a designer. For example, you can change the Comment property for a table using DBSetProp( ) as well as from the table designer. Because DBSetProp( ) makes changes directly to the database itself, dbc_BeforeModifyTable or dbc_AfterModifyTable will not catch changes made by DBSETPROP( ). To trap for changes that could be made either way, you would need to use dbc_BeforeDBSetProp, dbc_AfterDBSetProp, dbc_BeforeModifyTable, and dbc_AfterModifyTable to check for the appropriate changes.

Example

* Reports to the screen Event name, where it is called from and ;
* the parameter passed.
PROCEDURE dbc_BeforeDBSetProp ;
         (cName,;
          cType,;
          cProperty,;
          ePropertyValue)
 ? '>>   ' + PROGRAM()
 ?? ' in ' + SUBSTR(SYS(16),RAT('\',SYS(16))+1)
 ? '     Current DBC:     ' + SUBSTR(DBC(),RAT('\',DBC())+1)
 ? '     cName          = ' + TRANSFORM(cName)          + ' - ' + TYPE('cName')
 ? '     cType          = ' + TRANSFORM(cType)          + ' - ' + TYPE('cType')
 ? '     cProperty      = ' + TRANSFORM(cProperty)      + ' - ' + TYPE('cProperty')
 ? '     ePropertyValue = ' + TRANSFORM(ePropertyValue) + ' - ' + TYPE('ePropertyValue')+' /end/ '
ENDPROC

See Also

Enable or Disable DBC Events | dbc_AfterDBSetProp Event