Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Default unique ID values for a field in a remote table ?
Message
From
02/06/1998 11:50:28
 
 
To
02/06/1998 11:43:51
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00103696
Message ID:
00104031
Views:
45
>>Normal ID generation procedure (can be stored or regular) is foolowing:
>>You have separate table 'Setup.dbf' with two fields 'Tablename','NewID'.
>>***Procedure GetNewid
>[...]
>
>Right, thanks. This way the only way to retrieve the new index to show it on my form (without requerying the table), would be to call GetNewId as a regular procedure, maybe just before the TableUpdate(). But what should I do if the update fails for whatever reason ? I'd like to avoid 'holes' in the ID field, and so the stored procedure should be preferred. But then, how could I get the new id back to my code ?

Well, this stuff depends on the approach you apply when you save a new record. My preference is to generate NewId after all validations made, i.e. the only chance that INSERT will fail is network hardware problem, i.e. normally it will go Ok 99%, and some 'holes' is not a problem as long as database uses surrogate primary/foreign keys.
PS. When you 'RETURN nNewid', it means that you get it back to your code.
Edward Pikman
Independent Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform