Progress bar while doing a query or loading a table?

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
communi

Progress bar while doing a query or loading a table?

Post by 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!!

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by 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.

Communi

Post by 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?

[email protected]
Posts: 38
Joined: Tue 07 Mar 2006 17:13

other visual indicators

Post by [email protected] » 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..."

communi

Post by 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....

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by 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 = ""

Post Reply