Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Updating PK value of cursor
Message
From
19/03/2003 00:11:22
Km Kwun
Eastop Consultants Limited
Nt, Hong Kong
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Updating PK value of cursor
Miscellaneous
Thread ID:
00767380
Message ID:
00767380
Views:
41
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
Reply
Map
View

Click here to load this message in the networking platform