Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Retrieve autoincrement value from SQL server remote view
Message
From
08/02/2002 16:26:35
 
 
To
08/02/2002 16:16:41
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00550467
Message ID:
00617707
Views:
31
>If I use a PK table I will then have gaps in my IDs. I don't want any, is there a way to know what the next ID is or use flags on the records for inprocess and reusable and take the IDs depending on these flags or by adding a new ID?
>
>Tyler

I see where you're getting at, but I don't think it can be done. Consider this scenario: you have 2 users who are adding a record each at about the same time.

User 1 presses "Add" - which fetches the next ID. That ID is, say, 5.
User 2 also presses "Add". Which ID should he fetch? 5 or 6? We don't know if User 1 will ever save it's record, or if he will cancel. So either you get a gap, or you wait for the record to be written to know the ID.

I'm curious, though: why do you need to know the ID before you save it? I'm not saying there aren't valid reasons, but there might be another way around.
Sylvain Demers
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform