How to work continuously on other pages while executing stored proc in asp.net?
I have a stored procedure that I need to execute from asp.net button , It takes more than 30 mins to execute.
So h开发者_如何学编程ere I need to show a message like "In Process" while execution and disable couple of links..Once the execution is done I need to show "Last processed data and time" and enable the disabled links.
So in "In Process" stage we have to allow user to access other pages in the site. How it is possible?
Please help me on this requirement. Thanks in advance.
Your core problem is a design one. No action that takes that long should hold up the UI in any way. You could probably get around this via the use of flags, but I would first seriously reconsider whether you want to disable anything while this thing is running. Ideally, the user would run it, forget about it, and eventually get something back saying "It's done". Assuming they even care by then -- 30 minutes is a long time.
Stop the sp from being executed multiple times and run the sql call from another thread and when your done you can use Invoke or set a flag to let the main application thread know that it's finished and act accordingly. Although 30 mins is a REALLY long time
精彩评论