Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
I am working on a small Web application that involves some data entry. The tricky part(at least for me) is the data entry is divided into several steps. To make it clearer, the following are some of the steps involved.

1. User enters header information on one page and clicks on save button. User is moved to the next page.
2. He enters the details on another page and clicks on save button. User is moved to the next page.
3. He enters some more details on the last page and clicks on save button.

I made it that way because I think saving all the data at once might cause performance issues on the application especially when the usage is quite heavy. My problem is, if the user clicks on cancel at step 3, data from steps 1 and 2 should also be deleted from the database. I believe this will require a transaction but going through some of the articles on the net, transactions will sometimes require table locking and might also cause performance issues. Im stuck with this one and I really want to think for the approach before coding, instead of doing trial and error.

My question is, what is the ideal approach for this kind of scenario?

Appreciate your help.
Posted
Comments
Pong D. Panda 19-Apr-11 0:27am    
Nice question, vote up!

1 solution

Since this is a web app, you shouldn't enter any data to your database until the user fills in the final step: what if he goes through steps 1 and 2 and then decides not to complete step 3, but to go surf for Dilbert cartoons instead? Or go home?

Suddenly your data integrity is shot to hell anyway.

Instead, store your info from steps 1 and 2 in the Session, and save it all to the DB when the user has completed step 3 and all data is verified.

BTW: Do try not to make your software work around "I think saving all the data at once might cause performance issues" - try to make it work around the user, and what he is going to have to do as part of his workflow.
Unless the user is pasting hundreds of records from a file, any performance hit is going to be pretty trivial.
 
Share this answer
 
Comments
walterhevedeich 17-Mar-11 21:30pm    
Thanks.
Sergey Alexandrovich Kryukov 18-Mar-11 23:32pm    
Totally agree, it's a 5.
--SA

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