Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Retrieve autoincrement value from SQL server remote view
Message
De
08/02/2002 16:26:35
 
 
À
08/02/2002 16:16:41
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00550467
Message ID:
00617707
Vues:
36
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform