MaxForm.pas
资源名称:delphi.rar [点击查看]
上传用户:fh681027
上传日期:2022-07-23
资源大小:1959k
文件大小:1k
源码类别:
Delphi控件源码
开发平台:
Delphi
- unit MaxForm;
- interface
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- DBTables, Db, StdCtrls;
- type
- TForm1 = class(TForm)
- EmpTable: TTable;
- EmpQuery: TQuery;
- Database1: TDatabase;
- BtnTable: TButton;
- BtnQuery: TButton;
- procedure BtnTableClick(Sender: TObject);
- procedure BtnQueryClick(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form1: TForm1;
- implementation
- {$R *.DFM}
- procedure TForm1.BtnTableClick(Sender: TObject);
- var
- MaxSalary: Double;
- Tick: Cardinal;
- begin
- Tick := GetTickCount;
- EmpTable.Open;
- EmpTable.First;
- MaxSalary := 0;
- while not EmpTable.Eof do
- begin
- if EmpTable.FieldByName ('Salary').AsCurrency > MaxSalary then
- MaxSalary := EmpTable.FieldByName ('Salary').AsCurrency;
- EmpTable.Next;
- end;
- Caption := 'Time: ' + IntToStr (GetTickCount - Tick);
- ShowMessage (FloatToStr (MaxSalary));
- end;
- procedure TForm1.BtnQueryClick(Sender: TObject);
- var
- Tick: Cardinal;
- begin
- Tick := GetTickCount;
- EmpQuery.Open;
- Caption := 'Time: ' + IntToStr (GetTickCount - Tick);
- ShowMessage (EmpQuery.Fields[0].AsString);
- end;
- end.