Reputation: 71
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 ...
Upvotes: 0
Views: 120
Reputation: 524
The solution to your problem is to have the server generate the unique code and then deliver the registration form.
You can implement it in a way that whenever a client click on registration form, the server generates a key, probably a timestamp of the request and then pass it to the client where you can generate the form. Now, since each request will be processed by the server in a queue fashion, the timestamp generated will be different and hence a unique primary key.
Upvotes: 1