现在编一小程序,要实现对数据表定时查看记录,显示记录,并把查看时间记录下来,问题是我怎么提取系统时间,用某个函数吗?还是用控件?定时器如何用?
希望各位大侠出招,谢谢!

解决方案 »

  1.   

    在数据表中都增加一个时间字段,然后用timer定时搜索数据,同时保存时间now()到这个数据表的时间字段中。
      

  2.   

    那我用Ttable,就用不了SQL查询语句了,是不是必须用Tquery
      

  3.   

    有没有高手在线啊,帮我看下程序错在哪,谢谢type
      TForm1 = class(TForm)
        DataSource1: TDataSource;
        Query1: TQuery;
        Session1: TSession;
        Panel1: TPanel;
        Button1: TButton;
        DBGrid1: TDBGrid;
        StatusBar1: TStatusBar;
        Button2: TButton;
        Timer1: TTimer;  procedure Form1Create(Sender: TObject);   procedure  button1click(sender:TObject);  private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Form1Create(Sender: TObject);
    begin
    query1.Close;
    query1.SQL.Clear;
    query1.SQL.Add('insert into country(查询时间)values');
    query1.active:=true;
    end;
    procedure tform1.button1click(sender:tobject);begin
    timer1.enabled:=true;query1.SQL.add('update country set 查询时间=timetostr(now)');
    query1.SQL.add('select * from country');
    query1.active:=true; end;
    end.