Mike Yearwood
Toronto, Ontario, Canada
Information générale
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Network:
Windows 2000 Server
>>Naomi,
>>
>>>I think it's very hard to achieve what you're trying to achieve and probably not worth the effort. Your Order number should be a unique key and user should not even see it. If the later is the case, then it doesn't matter if some numbers are skipped.
>>
>>Sorry, but I must disagree with you on this one. Many systems use a "meaningful" Order # for printing on the sales order / invoice and for lookups by the number that the customer sees. If I order something from a company, I want to have a reference number that the system's user and I as the customer know about.
>>
>>This, however, does not have to be used as the primary key, which can itself be a "meaningless" auto-assigned number that the customer never sees. You are correct that it doesn't matter if numbers are skipped in the PK, but the customer's requirement in this case seems to be that they don't want skips in the sequence of meaningful order numbers.
>
>Hi David,
>
>Yes, I think I confused the two. In any case, I don't see a simple way to satisfy customer requirements...
It's quite easy. You generate the primary key (a guid) on the client/web server, not on the database server. You have the order number as auto incrementing. You save the record, and requery it using the generated primary key.
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement