Oracle Objects for OLE
Release 9.2

Part Number A95895-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents

Master Index

Feedback

Coding the Commit Button (Update and Add)

See Also
Quick Tour
Employee Form

The procedure for committing an update is similar for committing an Add, except that we place the dynaset in edit mode using DbEdit and then assign the new dynaset values.

Since we use the same commit button and the same commit event procedure to add and update, we introduce two global flags DoAdd and DoUpdate to distinguish between adding and updating. The Add and Update click event procedures set these flags.

The Commit event procedure for adding and updating does the following:

  1. Validates entered data. Handles errors when necessary.

  2. Uses DbAddNew to add records, else uses DbEdit for updates.

  3. Assigns entered data to dynaset fields, using the Fields().Value property.

  4. Updates database with new record, using DbUpdate.

  5. Disables the Commit button.

  6. Re-enables all other functional buttons including the Add and Update button.

  7. Sets the DoUpdate and DoAdd flags to false.
For clarity, we placed the data validation checks in Step 1 in a separate subroutine called DoValidationChecks(). We also moved the code that changes button and flag states in Steps 5 through 7 to a subroutine called SetAfterCommitFlags().

The code for the Commit function is broken into the following routines:

Commit_Click() Event Procedure

DoValidationChecks() Function

Update_Dynaset_Fields() Function

SetAfterCommitFlags() Subroutine


 
Oracle
Copyright © 1994, 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents

Master Index

Feedback