Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Show information when data is being loaded?

Status
Not open for further replies.

Jacksparrow87

Technical User
Jun 29, 2008
93
GB
Hi people,

I was hoping someone could help me out please.

When my vb application tried to load data from the database it can take a few second depending on the amount of users using it at the same time, I was hoping someone could help me out please. When the data is being loaded I want some sort of flashing label to say 'Data loading.... Please wait' and the timer to replace the mouse pointer. Is this possible? If the label is a bad idea could you suggest what else I could try?

Thanks
 
What is the code of the import?

Add something like:
Code:
Label1.Text = "Data loading. Please wait...."
'your code for importing the data

connection.Close()
Label1.Text = ""
 
I wouldn't do a flashing label. But disabling the controls on your form and showing a label that statically says "Data Loading..." while you are loading would be alright. If the lag is in executing the query and loading the DataSet and not in the control drawing itself with data, you might want to look at using a BackgroundWorker.

 
Thanks both of you, Riverguy have you tried that background worker? To be honest im a beginner when it comes to vb so im not sure how it works, but on my form I have various connections to my databases (as private subs)

and I call this subs throughout the form so that is why it takes time to load the data - would backgroundworker help me?

Also any chance you could help me with the coding to disbale the controls and showing the label? Shall I include the coding before the connection string and after the conection.close? How would I do the mouse part? Thanks
 
load data from the database it can take a few second depending on the amount of users

Have you considered making the query faster? I mean... unless you are loading millions of rows from the DB, it shouldn't take seconds to do (no matter how many users are connected to it).

I encourage you to post the query that is slow to load. Also, indicate the number of rows (on average) are returned. I suspect there are things you can do to improve the performance.

In another thread, you mentioned that you recently upgraded from Access to SQL Server. In my experience, Access does a pretty good job of 'auto-magically' creating indexes for you. With SQL Server, you need to do this manually.

In my own application, I've taken queries that run in seconds and optimized it to take milliseconds instead. Seriously... post your code and I'll take a look to see if any improvements can be made.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Here's what I would like you to do...

Open SQL Server Management Studio
Connect to the correct database
open a new query window.
Load your query in to the window.

Then, click Query -> Analyze Query In Database Tuning Advisor

Then, Click Actions -> Start Analysis

The Database Tuning Advisor will suggest indexes to improve performance.

Hope this helps.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top