|
Hi, Is there any approach in stored procedure code level to restrict the procedure to call twice on SUBMIT button. waiting for your valuable inputs.
(comments are locked)
|
|
Prevention of user submitting twice should be handled at application level. This is the best way of doing it. I do not think handling it at database level would help your cause. You may end up with something undesired. @Usman I've seen this during my years as a web developer. It isn't always the user clicking twice, some other weirdness happens that calls the stored proc twice. It is usually less than 10ms apart--too quick for consecutive clicks. This was especially concerning for us during credit card processing apps.
Aug 08 '12 at 11:10 PM
Scot Hauder
agree, the UI needs to handle this. the first step in the code needs to disable the button, then go on to make the request to the database. Logic in the database to recognise duplicate requests within NN (milli)seconds could also help but the UI needs to prevent the user causing the problem.
Aug 09 '12 at 09:18 AM
Fatherjack ♦♦
@Scot In that case It still smells like the web application OR application server being the culprit. Some serious Stress/Regression Testing with different option like very low network latency etc on application side needs to be done. Since I am sure there would be an/multiple application server/s being working as the middle-were, a check with NN milliseconds may still not be the best choice as it may cause some unwanted rollbacks.
Aug 09 '12 at 10:08 AM
Usman Butt
(comments are locked)
|
|
You're saying that you want to execute the procedure two times? Then I would either execute it twice or just run the command within it two times. Thank you Grant, I don`t want to call it twice. If the user accidentally clicks twice on SUBMIT button, Stored Procedure calls twice. In this situation how to restrict the second call from db side.
Aug 08 '12 at 03:15 AM
satya
That's different than what you asked. In this case, any data submitted should have a unique constraint on the table to prevent duplicate data from being entered. That's all you have to do. Clicking submit any number of times will cause the insert to fail.
Aug 08 '12 at 09:53 AM
Grant Fritchey ♦♦
Hey @satya, I just looked, after 18 questions you've never accepted an answer on any of them. If someone has helped you out, please mark the question answered by clicking on the check box under the appropriate answer. It's just below the little thumbs down symbol.
Aug 08 '12 at 09:58 AM
Grant Fritchey ♦♦
(comments are locked)
|

