Solved

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

Posted on 2011-02-18
4
724 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
  • 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
no14 challenge 14 56
countHi2 challenge 7 44
groovy example issue 10 65
can't find the executable in Simulator 1 51
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

708 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now