Slow response binding to datagrid

G

Guest

Hi,

I'm using a text box's text changed event to autocomplete a datagrid as the
user types in the search value ('A' returns many, 'Ax' returns fewer etc).

The first few letters typed in take a while to populate the datagrid. Once
it populates, there is no further problem, each new text change event
immediately returns a fresh set of rows.

I found it slows down when binding the dataset to the datagrid the first
time, but subsequent times no problem. I have pinged the DB with a connection
before starting the initial connection but this makes no difference.

// Bind the data grid to the results
dgDisplayResults.DataSource = dsResults; // slows here first time
round,then ok

Any clues as to what could be causing this?

Many thanks for any ideas
Ant
 
A

Alec MacLean

I have noticed same behaviour in both Win- and Web-forms datagrids when in
debug mode (using VS2k3). The delay doesn't seem to occur when compiled in
Release mode, so perhaps the associated debug symbols are causing the
initial delay?

Do you find the problem still occurs in the Release compiled version?

Also, possibly the query is not optimised on first run, then being
subsequently optimised, improves the return times? Not sure this would
really be the issue, but you could examine the execute duration in Query
Analyser.

Al
 
G

Guest

Hi Alec,

Thanks for sharing your experiences. I tried in release mode but to no
avail. i have since noticed that loading another form stops the initial lag
time. Interestingly the form also takes a while to load so I'm going to
investingate what they share & try to pre load 'that' (whatever that may turn
out to be). I'm precompiling the query using prepare. Either way doesn't
change things, but thanks for the ideas. I will have a look at it in query
analyser.

Thanks for your assistance anyway
Ant
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top