Progress bar while doing a query or loading a table?

Progress bar while doing a query or loading a table?

Postby communi » Thu 22 Jun 2006 09:33

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!!
communi
 

Postby Alexey » Thu 22 Jun 2006 09:48

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.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby Communi » Thu 22 Jun 2006 10:58

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?
Communi
 

other visual indicators

Postby john@haldi.net » 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..."
john@haldi.net
 
Posts: 38
Joined: Tue 07 Mar 2006 17:13

Postby communi » Thu 22 Jun 2006 15:36

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....
communi
 

Postby Alexey » Fri 23 Jun 2006 06:28

Why can't you do the following:
Code: Select all
StatusBar1.Text = "query executing, please wait..."
MySqlDataReader reader = MySqlCommand1.ExecuteReader()
StatusBar1.Text = ""
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43


Return to dotConnect for MySQL