Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Generate Primary Key
Message
From
04/12/2003 10:22:06
 
 
To
03/12/2003 19:47:11
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Miscellaneous
Thread ID:
00855292
Message ID:
00855868
Views:
12
>Hi,
>Thank you for reply.
>Then do you have any suggestions?

Umm, Hilmar has more experience than I do?

>I plan to set lAutoPrimaryKey = .F., create a uniqueID BizObj class, then retrieve the ID value without increase it kBizObj.OnNew()(For display purposes). Then, call loDataAccess.GeneratePrimaryKey() during kBizObj.save(). Do you think is is worth? BTW, I don't see any hook that allow me to do this, since PreSaveHook() is not in BEGIN TRANSACTION scope. Any ideas?

I've never tried to do this, so I'm speaking hypothetical. It looks like you're on the right track, however, I'm not sure you can use NewID() as the default field value (what GeneratePrimaryKey uses. Simple testing should prove me wrong(I hope), but I'm worried that with a primary/candidate index you'll have an index violation trying to add more than one record. Local views, table buffered to avoid accidental saves, should avoid this.

As for PreSaveHook() not being in the transaction, you might suggest to Kevin that it be moved there.
Previous
Reply
Map
View

Click here to load this message in the networking platform