Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 757
  • Last Modified:

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

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
hawkerpac
Asked:
hawkerpac
  • 3
1 Solution
 
ThommyCommented:
Use a TTimer and call TAdoQuery.Refresh in OnTimer event...
0
 
ThommyCommented:
You can also try using DBGrid.refresh...
0
 
hawkerpacAuthor Commented:
can you please give me the syntax? code?

Thanks
0
 
ThommyCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now