Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to enhance TDBGrid performance in a slow ODBC connection Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
Enhance TDBGrid performance in a slow ODBC connection 27-Sep-02
Category
DB-General
Language
Delphi 2.x
Views
127
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

I am using a TDBGrid through a slow ODBC connection to the data. When I scroll the 
grid it changes the selected row and takes an age to update all the "detail" 
queries run off it. The time it takes to update the "detail" queries wouldn't be a 
problem if I could scroll the grid and then select a new row once the one I want 
was in view. Any ideas?

Answer:

Don't use automatic linking, because it re-executes detail queries on every 
datachange. Instead, use manual linking with timer:


1   procedure Datasource1Datachange(...)
2   begin
3     Timer1.Enabled := false;
4     Timer1.Enabled := true;
5   end;
6   
7   
8   procedure Timer1Timer(..);
9   begin
10    {details will be refreshed only when timer expires}
11    DetailQ.Params[0].AsInteger := MasterQLinkField.AsInteger;
12    DetailQ.Close;
13    DetailQ.Open;
14  end;



I use timer interval from 300 - 500 ms. With this small trick you'll see a real performance boost.

			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC