Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2011-02-18
4
Medium Priority
?
742 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 2000 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

[Webinar] Cloud Security

In this webinar you will learn:

-Why existing firewall and DMZ architectures are not suited for securing cloud applications
-How to make your enterprise “Cloud Ready”, and fix your aging DMZ architecture
-How to transform your enterprise and become a Cloud Enabler

Question has a verified solution.

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

The purpose of this article is to demonstrate how we can use conditional statements using Python.
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 concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
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.
Suggested Courses

916 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