How to show progress of sql server SP on winform client?
we have winforms client application that calls .net web services which further calls sql server SP . on one particular occasion, we are calling sp which does 开发者_JS百科heavy batch processing on the server. is there any way we can update progress back on the winform client while sql server sp is running ? I thought of calling my main webmethod asynchronously which does all batch processing. and then call another webmethod in separate thread which periodically queries server to know progress. is this possible ? or is there any other approach to achieve this? please advice.
thanking you in advance.
I have done this before using a method similar to what you suggest. The stored procedure updates a status table as it runs, and the other thread queries that status table with the NOLOCK hint. The interesting thing I found in doing it this way is that, if the work is happening in a transaction, and the transaction gets rolled back, the status bar will even run backwards as it rolls back! However, large amounts of work should probably not be done in a single transaction for performance reasons.
精彩评论