Connecting Tech Pros Worldwide Forums | Help | Site Map

How to run a store procedure and show users somthing is happening

Member
 
Join Date: Nov 2006
Posts: 93
#1: Oct 21 '08
Hi, I am running a store procedure, which takes a long time so i need some way of telling the user somthing is happening. Any one have a sample code of how to do this?

insertAlias's Avatar
Forum Leader
 
Join Date: Apr 2008
Location: San Antonio, TX (USA)
Posts: 2,608
#2: Oct 21 '08

re: How to run a store procedure and show users somthing is happening


You could use a progress bar. Maybe set it to continuous. You'll want to execute the SP on a separate thread.
Plater's Avatar
Moderator
 
Join Date: Apr 2007
Location: New England
Posts: 7,161
#3: Oct 21 '08

re: How to run a store procedure and show users somthing is happening


I have seen a sneaky trick (most often employeed in webpages, but it can work anywhere) Is to simply have some sort of animation (a gif perhaps?) that becomes visible when the task is started, and invisible when the task is completed.
There is no notion of "task is x% completed", but it does alert the user that something is happening.

I myself popup a static "LOADING..." dialog while I am doing some processing.
Member
 
Join Date: Nov 2006
Posts: 93
#4: Oct 21 '08

re: How to run a store procedure and show users somthing is happening


How is this done i was looking at using javascript to make a div visible or not, how would this be done
insertAlias's Avatar
Forum Leader
 
Join Date: Apr 2008
Location: San Antonio, TX (USA)
Posts: 2,608
#5: Oct 21 '08

re: How to run a store procedure and show users somthing is happening


Quote:

Originally Posted by Taftheman

How is this done i was looking at using javascript to make a div visible or not, how would this be done

Oh ok, this is web based.

Can you use the .NET Framework 3.5? There is a perfect premade solution, if you can. UpdatePanel and UpdateProgress.

If you can't, I'd suggest writing a page that does nothing but execute your SP. Then, from another page, use an XmlHttpRequest javascript object to invoke that page, and show a DIV with an animated GIF in it.
Plater's Avatar
Moderator
 
Join Date: Apr 2007
Location: New England
Posts: 7,161
#6: Oct 21 '08

re: How to run a store procedure and show users somthing is happening


If the program flow is roughly:
  • User clicks a button(or something else)
  • A postback is fired
  • Stored procedure is executed, taking up some time
  • Results are sent back, which is a page reload

You can use the sneaky trick other websites use
  • (Page is loaded with an image hidden)
  • User clicks a button(or something else)
  • The image is unhidden (image can be a large picture of "please wait" or anything you want)
  • A postback is fired
  • Stored procedure is executed, taking up some time
  • Results are sent back, which is a page reload (which means image is hidden once more)

What I did with my page, to help ensure the user would not keep clicking the button, was to use javascript to change the CSS style of the button to be hidden and to make visible a <div> that said "Please wait..." where the button used to be
Reply


Similar .NET Framework bytes