Click here to Skip to main content
15,917,473 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
hi, my database have many records .and i want select it , i want show it in progress bar when select records, what do?
Posted
Updated 15-Aug-11 7:22am
v2
Comments
Manfred Rudolf Bihy 15-Aug-11 13:43pm    
Please edit your question and add more details about what your progress bar is supposed to indicate.
If you want to indicate that an SQL statement is still running you should probably use something other than a progress bar. In order to show true progress you'd need some indication how much of the work has already been done. If this information can not be acquired your best bet would be to use some sort of activity indicator.
Wendelius 15-Aug-11 14:03pm    
Manfred Rudolf Bihy 21-Aug-11 7:34am    
MS might have squeezed a Marquee style into a progress bar, which still doesn't make it a progress indicator, but rather an indicator that somthing is happending. The essence of what I'm saying is that when true progress can not be measured any kind of available activity indication would do, but I should not trick the user into thinking that there is in fact some kind of progress that is being tracked.

Cheers!

In order to do that you would have to execute the select asynchronously and in the meantime show some kind of indication that the query is in progress.

One way to do the fill asynchronously is to use BackgroundWorker [^]. So basically you would put the data adapter fill (or whatever you use) in the DoWork event.

A side note: Since users are typically not very willing to wait for long times I would put most of the effort to enhancing the query performance, if possible and use the progress indicator as 'the last option'. Just having many records doesn't mean that the queries are automatically slow. That maybe for example because of inadequate indexing.
 
Share this answer
 
I'm not sure what do you have to do, but you could check this article Showing progress bar in a status bar pane[^] and display your query
 
Share this answer
 
This post[^] might help.
 
Share this answer
 
Unless you retrieve the records one at a time (what a huge waste of time and bandwidth), a progress bar is going to be fairly pointless (in the normal sense of the word "progress").

What you want is some indication that the process is running, because when you retrieve a bunch of records all at once, there's no progress being reported. At the same time, you don't necessarily want the UI in your app to freeze up while you're waiting for the database transaction to complete. This means that you need to run your query from a thread, and put make your ProgressBar a marquee style (progressbar1.Style = ProgressBarStyle.Marquee;), and put it in your StatusStrip control.
 
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