Click here to Skip to main content
15,915,328 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a Application In Vb.Net .I am Developing This Application on Microsoft Visual Studio 2008 , VB.NET, Sql Server 2005 , Crystal Report.

And That Application Have Registration Form . Now My Question Is
This Application is Installed On 5 different Computer In a Network . At the Mean time all 5 users
are Open Registration form Then They click on Save button on same time . I Have a table registration , and that has a column (code) that is primary key. whenever they want to save the record only one user can get save the record . all 4 users are rollback the transaction because of primary key violation error. Therefor i want to generate code on a queue basis .. where user can wait to get a Unique Code of that Record and i dont want to users request to rollback ...
Posted
Updated 29-Sep-13 23:32pm
v2

1 solution

Mohammad,

INSERT
When you create a row/record in a table, you need a primary key; which has not been used, yet. this means, you need a common process; which can lookup for a new key to use before the key in the row to insert. Or you need a key; which is generated by the database, applying a IDENTITY column. This means, there will be 5 rows.

UPDATE
When you update a row; the last user update wins. There's not much else you can do. However, this shouldn't create a primary key violation.

:)
 
Share this answer
 
v2
Comments
Mohammad Nawaz 30-Sep-13 8:32am    
I Have a Primary key Which Generated by Store Procedure But In Case Of Multiple Client Are using Our Application there Generate an error primary key duplicate.
I want to store the request of clients in a queue manner in my application
how can i resolve it

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900