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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Taftheman
    New Member
    • Nov 2006
    • 93

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

    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?
  • Curtis Rutland
    Recognized Expert Specialist
    • Apr 2008
    • 3264

    #2
    You could use a progress bar. Maybe set it to continuous. You'll want to execute the SP on a separate thread.

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #3
      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.

      Comment

      • Taftheman
        New Member
        • Nov 2006
        • 93

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

        Comment

        • Curtis Rutland
          Recognized Expert Specialist
          • Apr 2008
          • 3264

          #5
          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.

          Comment

          • Plater
            Recognized Expert Expert
            • Apr 2007
            • 7872

            #6
            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

            Comment

            Working...