G
Guest
In a multi-user environment, how would I prevent users from adding Orders
with identical OrderID. For instance I have following tables in my database
Order
==================
OrderID Identity field
CustomerID
OrderDate
DeliveryAddress
OrderDetail
==================
OrderID
ProductID
UnitPrice
Quantity
Now, User A and User B view all the order placed by a customer. OrderID in
the DataSet would have AutoIncrement to True. When User A and User B add a
new order they both will have identical OrderID in the DataSet and add method
will fail for one of the user because of Primary Key violation constraint.
How can I prevent this from happening, so that it assigns a different
OrderID without generating an error?
with identical OrderID. For instance I have following tables in my database
Order
==================
OrderID Identity field
CustomerID
OrderDate
DeliveryAddress
OrderDetail
==================
OrderID
ProductID
UnitPrice
Quantity
Now, User A and User B view all the order placed by a customer. OrderID in
the DataSet would have AutoIncrement to True. When User A and User B add a
new order they both will have identical OrderID in the DataSet and add method
will fail for one of the user because of Primary Key violation constraint.
How can I prevent this from happening, so that it assigns a different
OrderID without generating an error?