CATALOG()

BeforeModifyConnection, AfterModifyConnection

These database events fire when a connection is modified in the Connection Designer.

Usage

PROCEDURE DBC_BeforeModifyConnection( cConnectionName )   PROCEDURE DBC_AfterModifyConnection( cConnectionName, lChanged )

Parameter

Value

Meaning

cConnectionName

Character

The name of the connection.

lChanged

Logical

Indicates whether the connection was changed.


As is the case with other before-and-after pairs of events, you can prevent a connection from being modified (the Connection Designer won't appear) by returning .F. in the BeforeModifyConnection event, while the AfterModifyConnection event simply receives notification that something happened.

Like other connection-related events, VFP refuses to execute the method of an object in these events when they're fired visually (that is, when you choose Connections from the Database menu to display the Connections dialog and then click Modify). For example, suppose you have code like the following:

PROCEDURE DBC_BeforeModifyConnection(cConnectionName) loObject = NEWOBJECT('MyClass', 'MyLibrary.VCX') loObject.SomeMethod()

If you trace this code, you'll see the object being instantiated, but the call to SomeMethod is skipped over as if it were a comment line.

Example

* This goes in the stored procedures of a database.   PROCEDURE DBC_BeforeModifyConnection(cConnectionName) WAIT WINDOW PROGRAM() + CHR(13) + ;     'cConnectionName: ' + cConnectionName   PROCEDURE DBC_AfterModifyConnection(cConnectionName, lChanged) WAIT WINDOW PROGRAM() + CHR(13) + ;     'cConnectionName: ' + cConnectionName + CHR(13) + ;     'lChanged: ' + TRANSFORM(lChanged)   * End of stored procedures.     * Create a connection, and then modify it.   CREATE CONNECTION TestConnection DATASOURCE TasTrade MODIFY CONNECTION TestConnection

See Also

BeforeCreateConnection, BeforeRenameConnection, BeforeDeleteConnection, Create Connection, Database Events, Modify Connection


View Updates

Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.



Hacker's Guide to Visual FoxPro 7. 0
Hackers Guide to Visual FoxPro 7.0
ISBN: 1930919220
EAN: 2147483647
Year: 2001
Pages: 899

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net