Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi i have a two tables namely tblRates and tblRatesdetail.i have a simple web application and basically it will be contacted by 20 person at the same time(Multi user environment)
basically tblrates includes ratecode(autogen number) and after adding records to tblrates then tblRatesdetail record data will be added to the db.that tblrate table rateCode will be act as the forign key in the tblRatedetails table.

E:x in tblRates

rateCode ratename maxweight add price
100 , testrate , 2.00 , 0.50



in tblratedetails

rateCode(fk) weight price
100 , 0.5 , 10
100 , 1.0 , 12
100 , 1.5 , 14
100 , 2.0 , 16

ratecode i got from the SQL Max function after header record inserted to system.
Then i have a doubt then when multi user environment that multiple users are entering data to the system,is there any way to maximize accuracy of the data being stored in the system, what is the best practice to avoid any mistakes. bacause i have doubt Since data goes for 2 tables and usage of Max Function. when one user insert record to tblrates and while its getting MAx rateCode from tblRates is there any possibility for other user record to insertion for tblrates?if that happens how to avoid that problem? Thanks in Advance if you could assist in this matter!!!how to manage multiusers effectively?
Posted
Updated 18-Oct-12 5:01am
v3

1 solution

This[^] article might lead you in the right direction.
 
Share this answer
 
Comments
fjdiewornncalwe 18-Oct-12 12:21pm    
+5. Good answer. Just a note that along with locking, transactions would be the right way.
R. Giskard Reventlov 18-Oct-12 13:42pm    
Thanks and you are correct. The article does give an example wrapped in a transaction so should be good for the OP.

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