[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 881
  • Last Modified:

Stored Proc Progress bar

I have a stored proc that synchronises two db's. My question is when i call the stored proc from my application it shoukd show the status back to the user. something like a progress bar. when i googled i came through something called Background worker. can anyone one give an example how i can use it. or is there any other way.
0
AnnaJames77
Asked:
AnnaJames77
  • 3
  • 2
  • 2
  • +2
1 Solution
 
DhaestCommented:
The biggest problem with your progress bar will be setting the initial value of the "100%".
How do you know how long your sp will run ?
What you perhaps can do is split the sp into several smallers (fe 5 pieces) and update the progressbar each time when you call the next one.

How To Update Controls Using BackgroundWorker in VB.NET
http://vbnotebookfor.net/2007/09/24/how-to-update-controls-using-backgroundworker-in-vbnet/
0
 
CodeCruiserCommented:
>synchronises two db's.
How?

I think you would want to use a marquee style progressbar so that the stored procedure keeps running in the background but the UI is responsive so user is not frustrated.

http://www.youtube.com/watch?v=ZiVv_uPWOEs
0
 
AnnaJames77Author Commented:
thankyou CodeCruiser. but how can we know that the stored proc has completed its excution???
0
Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 
dexion432Commented:
"but how can we know that the stored proc has completed its excution"

returns a return value or writes an "i am completed" row into the db and you poll it
0
 
DhaestCommented:
0
 
Éric MoreauSenior .Net ConsultantCommented:
0
 
CodeCruiserCommented:
If you dont use asynchronous ADO.NET, how do you know currently that stored procedure has completed? All you do is that you move the current code in backgroundworker and add a progressbar on the form.
0
 
AnnaJames77Author Commented:
Codecrusier can you pls let me know how to use the backgroundworker. When i googled too i got such an answer. but i donot know how to use it. In google got many answers but dint get one which uses a stored procedure with backgroundworker. CAn you help on this.
0
 
CodeCruiserCommented:
The backgroundworker has 3 methods/events. You put the code that is executing the stored procedure in the backgroundworker.DoWork method. You may use the backgroundwork.ReportProgress to update the UI about the progress of the process but you wont need that in this case. Then you have the backgroundworker.WorkerCompleted which can be used to clean up stuff such as hiding the progressbar and showing a message that processing has completed.



1) Add a backgroundworker to the form. Also add a progressbar and set its style to marquee.
2) Create an eventhandler in code for DoWork method
3) Paste code in that method and call the backgroundworker.RunWorkerAsync when you want to start the processing (such as in a button click). Before that, set the progressbar to visible
4) When the backgroundworker completes, hide the progressbar.









0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now