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.
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.