1,105,585 Community Members

Auto Number Generation Problem

Member Avatar
Arjun_Sarankulu
Junior Poster
169 posts since Jan 2011
Reputation Points: -3 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

I have developed a web appication for Hospital which manages Patient Information.
When the web application is simultaneously opened on more than one machine.
While filling data on one machine it redirect to next page which autogenerates SID.
but when user at the same time try to fill data from another machine it generates same ID and while filling data.
it says ID already exist and give server error.
How can more than one user work simultaneously.
Kindly Suggest the same.

Member Avatar
nmaillet
Posting Pro
535 posts since Aug 2008
Reputation Points: 97 [?]
Q&As Helped to Solve: 106 [?]
Skill Endorsements: 7 [?]
 
0
 

One option is to let the database (assuming you use one) handle the ID generation. Basically, you let the user enter all of the information, then let the database assign an ID when it is inserted into the table. This can be utilized by many database engines with a simple keyword when creating or altering a table (i.e. IDENTITY for SQL Server, AUTO INCREMENT for MySQL, etc.). Modern database engines can generally handle concurrent database access quite well. See here for more info.

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article