Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Updating PK value of cursor
Message
De
19/03/2003 00:11:22
Km Kwun
Eastop Consultants Limited
Nt, Hong Kong
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Updating PK value of cursor
Divers
Thread ID:
00767380
Message ID:
00767380
Vues:
40
The help page for UpdateTable() reads:

"When table buffering is enabled, you can move away from the current record in the following CursorAdapter events: BeforeInsert, AfterInsert, BeforeUpdate, AfterUpdate, BeforeDelete, AfterDelete.
You can also modify data in the cursor. This functionality supports scenarios such as retrieving the autoincrement value from the base table and inserting it into the cursor. When this scenario occurs, the CursorAdapter object should automatically return to the record whose changes are about to be committed after the event has occurred and commit the changes."

I tried to replace the key field of a newly inserted row of a CurorAdapter cursor with the newly generated key (got from the autoincrement field of the base table) in the AfterInsert event. But when I stepped out the event, the new row disappeared from the cursor. It seemed that a TableRevert() command was implicitly run by the system. I did try putting a TableUpdate() after the replace command with no help. Once I removed the "replace" command, the "revert problem" did not occur but the key field was not updated. I also tried it in AfterCursorUpdate event and the same problem was encountered.

Can anybody tell me which is the right event for updating the key value (with that generated from the base table) of a newly inserted row of a CA cursor?

TIA
Répondre
Fil
Voir

Click here to load this message in the networking platform