Using the progress bar control to track database activities
-
I am selecting and inserting large amounts of data into a SQL database and I would like to inform the user of the progress. How do i do this using a progress bar or something similar.
-
I am selecting and inserting large amounts of data into a SQL database and I would like to inform the user of the progress. How do i do this using a progress bar or something similar.
Do you have some kind of looping structure for selecting and inserting records? How do you do it? When I know, it will be easier to explain how you would implement the progressbar. Steve
-
I am selecting and inserting large amounts of data into a SQL database and I would like to inform the user of the progress. How do i do this using a progress bar or something similar.
In order to do this, you would need to do lots of little inserts, instead of one big one. This will slow down the overall process considerably. If you're stuck with doing it this way, then implimenting a progress bar is trivial. If you're not, I can't see a way to do it without slowing things down.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
-
Do you have some kind of looping structure for selecting and inserting records? How do you do it? When I know, it will be easier to explain how you would implement the progressbar. Steve
I am selecting and inserting arge amounts of data into a SQL database. In terms of the inserting i have a solution i think i can work with. I will simply get the count of the number or records in the dataset and set the progress bar max value to this. I will then increment the progress bar counter each time a record is added. The problem is liking the progress bar to the selection process. When I am retrieveing these thousands of records from the databse I wamt to inform the user what percentage of records have been retrieved so far. Is there any way to know what percentage of records have been retrieved so far.
-
In order to do this, you would need to do lots of little inserts, instead of one big one. This will slow down the overall process considerably. If you're stuck with doing it this way, then implimenting a progress bar is trivial. If you're not, I can't see a way to do it without slowing things down.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
How do I track the amount of records recieved so far by a select statement?
-
I am selecting and inserting arge amounts of data into a SQL database. In terms of the inserting i have a solution i think i can work with. I will simply get the count of the number or records in the dataset and set the progress bar max value to this. I will then increment the progress bar counter each time a record is added. The problem is liking the progress bar to the selection process. When I am retrieveing these thousands of records from the databse I wamt to inform the user what percentage of records have been retrieved so far. Is there any way to know what percentage of records have been retrieved so far.
Well, if you know the total of records in the first place, just divide this by 100. The you could do something like this: Value = CInt(TotalRecords/100) 'Equals 1% Add a handler for the RowChanged event of your table(s). Then in the RowChanged events: Check for: e.Row.RowState = DataRowState.Added and update a public counter... Check it against 'Value' and update the ProgressBar.Value when it meets the criteria you choose. Just one way to do it. It is going to slow down your inserts to some degree though... Steve -- modified at 15:43 Friday 18th August, 2006