Solved

How to auto refresh the data in my TBGRID which is linked with TADO Query /  TDatasource?

Posted on 2011-02-18
4
738 Views
Last Modified: 2012-05-11
I have the data displayed in the Grid. Right now when they click the update button the data gets refreshed. How can i automate the update. Like every 5 mins i would like the data to be refreshed?

Thanks in Advance.
0
Comment
Question by:hawkerpac
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 19

Expert Comment

by:Thommy
ID: 34929752
Use a TTimer and call TAdoQuery.Refresh in OnTimer event...
0
 
LVL 19

Expert Comment

by:Thommy
ID: 34929793
You can also try using DBGrid.refresh...
0
 

Author Comment

by:hawkerpac
ID: 34929829
can you please give me the syntax? code?

Thanks
0
 
LVL 19

Accepted Solution

by:
Thommy earned 500 total points
ID: 34929954
Place a TTimer on your form, set interval to 5000 ms (5 mins) and set enabled:=true


type
    TfMain = class(TForm)
    Timer1: TTimer;
    procedure TimerTimer(Sender: TObject);

  private
        
...

implementation

{$R *.dfm}

procedure TfMain.Timer1Timer(Sender: TObject);
begin
  ADOQuery1.Refresh;
  //DBGrid1.Refresh;
end;

Open in new window

0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Navigation is an important part of web design from a usability perspective. But it is often a pain when it comes to a developer’s perspective. By navigation, it often means menuing. This is less theory and more practical of how to get a specific gro…
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question