Click here to Skip to main content
15,894,460 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
After I have updated the data table in disconect mode I want to update the DB SQL and show a progress bar that will indicate the progress of the data saving.
I dont know how to connect the save process to the progress bar.

I would thank you very much for useful info.
Posted
Updated 9-Aug-10 12:30pm
v2
Comments
Dalek Dave 9-Aug-10 18:31pm    
Edited for Readability and Spelling.

if you are using sqldataadapter it has an event for "rowupdating" ... you can utilize that event to display the stage of the progress. Just by putting the incrementing progress in the event handler and setting the max on the progress bar to the number of dirty rows on the target table ...

hope that was helpful
 
Share this answer
 
Well,
If you are in a batch, I think you can show the percentage in progressbar by separating each individual steps of the whole batch, and then calculate the percentage of individual item out of the whole batch.

Like say you have 20 statements, and you are running the 2nd item, you will do

percentage = (2/20) *100

You better do the calculation during batch work using a new Thread, and invoke an event from that thread to update the progress bar. Using a new thread will make the UI thread smooth.

As Christian suggested, you might also try to make it indeterminate, and for that too, you need to use a separate thread, so that the progressbar doesnt stop while you are running database updates.
 
Share this answer
 
Say you are updating 1 million records. Create a loop to update those records in your stored procedure (doing them in small batches of, say, 10,000 at a time). During each iteration of that loop, also update another table to indicate the progress through the loop. Then, have your C# program poll that progress table to check what percent complete it is.
 
Share this answer
 
The only way to 'connect' your progress bar to a process, is to make that process occur in lots of small steps, which, with a DB update, is very likely to slow it down. Show an indeterminate progress bar, in cases where you can't easily track progress.
 
Share this answer
 
Comments
SerpentineV01 8-Aug-10 17:42pm    
Intresting. but how could i break the update process to smaller steps, and how would it help me to track the procidure.
in adition what is the "indeterminate progress bar", and how would it help me.

thank you for your attention.
Well guys thank you, your answers were more than sufficient!:thumbsup:
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900