Click to See Complete Forum and Search --> : How to show status/progress?


SGill
November 19th, 2004, 02:49 PM
Problem definition: End user selects the checkbox list from a ASP.NET page, each checkbox list item associated to a unique query. Then end user can click "Run" all selected queries. Then extracting data from the database by running selected queries one by one, each query takes some server time.
I want to show status to the end user
e.g.
"Running Query: 1 of 10 completed..."
"Running Query: 2 of 10 completed..." ....

Could some one can help me how I can show status to the client. I am open to have soluton in C# or javascript.

Many thanks
S Gill

jeremiah98383
December 6th, 2004, 04:47 PM
The short answer is: You can't. :cry:

The long answer is: You might be able to rig something that is a decent imitation of the desired behavior.

You have two obstacles.

One, when your page is submitted it will not post back to the client at all until all processing is completed. So, in order to post back to the client in a timely manner without waiting for all the queries to complete you need to run things in a separate process. In this situation you could have a stored procedure that kicks off a SQL job that runs all your selected queries perhaps.

Second , if you have some process running on your server (the SQL queries) it cannot "push" an update/response to a client. The client *must* initiate the request. So, how do you get the client to initiate the request without user intervention? Auto page refresh is really the only way.

Basically the solution consists of running the queries in a separate process so that your page can post back to the client right away and then having your queries write to some sort of Progress table as they complete. Then your page can query this table every time it auto refreshes and update the screen with info about which queries have been completed.

This is far from bulletproof, and takes a bit of work to implement, but I think it is about as close as you are going to get to what you are looking for. Good luck!

Andy Tacker
December 7th, 2004, 01:40 AM
I would tend to disgree with jeremiah98383

It is possible to show progress bar... you should look for this post (http://www.codeguru.com/forum/showthread.php?t=306966)

as SGill mentioned, the queries are executed one by one... that gives him apossibility to change the bitmaps as mentioned in the linked post.

hope it will help...

jeremiah98383
December 7th, 2004, 11:57 AM
Well, you can certainly show a progress bar using graphics and a little Javascript but it sounded like he did not want to just display something that lets the user know that the server is processing and to wait.

Unless, there is something that I am missing, a progress bar like that won't tell you when each individual query is done like he was asking for.

I don't see how having the queries being executed one by one would help. Since it is an ASP.net page even if you had code that was something like.

Run Query 1
Advance Progress Bar
Run Query 2
Advance Progress Bar
etc..

Only the last progress bar action would be seen because all processing is done on the server before being sent back to the client. Again, am I missing something here? :confused:

Andy Tacker
December 8th, 2004, 06:52 AM
It really depends upon the time it would take to finish a query...
I would recommend you to see something like MS Project server or MS Share point server.
when you connect to them, they download some controls. and in the process they show this kind of progress bar...