Page 1 of 1
Progress bar while doing a query or loading a table?
Posted: Thu 22 Jun 2006 09:33
by communi
Hi there,
is it possible to implement a progress bar into a vb form while executing a MySQL query so that the user can see the progress of a query or loading data from server? My query can take up to 1 minute, so users think the program has crashed. A progress bar or status text "Loading data" would be very useful so users can see the query is still running.
How to realize this?
Thank for your help!!
Posted: Thu 22 Jun 2006 09:48
by Alexey
You can use ExecutePageReader(...) method to retrieve not the whole dataset but some part of it that begins with given row number and has certain quantity of rows. Count all the records first, then divide the amount of the records on several parts and execute said method for each part incrementing ProgressBar.Value.
Posted: Thu 22 Jun 2006 10:58
by Communi
Thanks for your reply!
hmmm...is there no easier way to display the user that there are data being loading or that a query is still working? Perhaps without progress bar, only a little popup displaying "loading data, wait...!" that disappears after the query is executed?
other visual indicators
Posted: Thu 22 Jun 2006 15:10
Besides a pop-up message, other common visual indicators include:
1) Changing the cursor to a an hourglass or other icon while the query executes
2) Using a status bar message that says something to the effect "query executing, please wait..."
Posted: Thu 22 Jun 2006 15:36
by communi
John,
I tried this but it doesn't work properly
On start of query I changed a status message to "Query..." but there seems no possibility to catch the end of query so I can't change the status message back. You know what I mean? If there would be a feedback from the datatable which indicates that the table is loaded completely I could change the message....
Posted: Fri 23 Jun 2006 06:28
by Alexey
Why can't you do the following:
Code: Select all
StatusBar1.Text = "query executing, please wait..."
MySqlDataReader reader = MySqlCommand1.ExecuteReader()
StatusBar1.Text = ""