unit Umain;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, DBTables, StdCtrls;type
TFrmMain = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
DbCompDuty: TDatabase;
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
FrmMain: TFrmMain;implementation
uses UQueryStatEnd,UQueryed;
{$R *.dfm}procedure TFrmMain.Button3Click(Sender: TObject);
Var
strEmpID:string;
StrDateStart,strDateEnd:String;
TblEmp:TTable;
begin
if DlgQueryDuty.ShowModal:=mrOK then
Begin
TblEmp:=TTable.Create(self);
TblEmp.DatabaseName:='CompDuty';
TblEmp.TableName:='Employee';
TblEmp.Filtered:=True;
TblEmp.Filter:='Name='''+Trim(DlgQueryDuty.EditName.Text)+'''';
TblEmp.Open;
IF TblEmp.Eof THEN
begin
Application.MessageBox('没有找到相应的员工!','系统提示');
Exit;
End else
strEmpID:=TblEmp.fieldbyName('ID').AsString;
TblEmp.Close;
strDateStart:=FormatDateTime('yyyy-mm-dd 00:00:00',DlgQueryDuty.DTPickerStart.Date);
strDateEnd:=FormatDateTime('yyyy-mm-dd 00:00:00',DlgQueryDuty.DTPickerEnd.Date); with FrmDutyQueryed.TblQuery do
begin
if Active then
Active:=False;
Filter:='EmpID'+strEmpID+'and DutyDate>='''+strDateStart;
Filter:=Filter+'''and DutyDate<='''+strDateEnd+'''';
Filtered:=True;
Active:=True;
if not Eof then
Begin
FrmDutyQueryed.LblQuery.Caption:='查询结果:出勤'
+IntToStr(RecordCount)+'次'
FrmDutyQueryed.showModal;
end
else
Application.MessageBox('没有找到相应的出勤记录!','系统提示');
end;
end;end;错误是[Error] Umain.pas(37): Type of expression must be BOOLEAN
[Error] Umain.pas(67): Missing operator or semicolon
[Error] Umain.pas(76): Declaration expected but end of file found
[Fatal Error] CompDuty.dpr(7): Could not compile used unit 'Umain.pas'
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, DBTables, StdCtrls;type
TFrmMain = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
DbCompDuty: TDatabase;
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
FrmMain: TFrmMain;implementation
uses UQueryStatEnd,UQueryed;
{$R *.dfm}procedure TFrmMain.Button3Click(Sender: TObject);
Var
strEmpID:string;
StrDateStart,strDateEnd:String;
TblEmp:TTable;
begin
if DlgQueryDuty.ShowModal:=mrOK then
Begin
TblEmp:=TTable.Create(self);
TblEmp.DatabaseName:='CompDuty';
TblEmp.TableName:='Employee';
TblEmp.Filtered:=True;
TblEmp.Filter:='Name='''+Trim(DlgQueryDuty.EditName.Text)+'''';
TblEmp.Open;
IF TblEmp.Eof THEN
begin
Application.MessageBox('没有找到相应的员工!','系统提示');
Exit;
End else
strEmpID:=TblEmp.fieldbyName('ID').AsString;
TblEmp.Close;
strDateStart:=FormatDateTime('yyyy-mm-dd 00:00:00',DlgQueryDuty.DTPickerStart.Date);
strDateEnd:=FormatDateTime('yyyy-mm-dd 00:00:00',DlgQueryDuty.DTPickerEnd.Date); with FrmDutyQueryed.TblQuery do
begin
if Active then
Active:=False;
Filter:='EmpID'+strEmpID+'and DutyDate>='''+strDateStart;
Filter:=Filter+'''and DutyDate<='''+strDateEnd+'''';
Filtered:=True;
Active:=True;
if not Eof then
Begin
FrmDutyQueryed.LblQuery.Caption:='查询结果:出勤'
+IntToStr(RecordCount)+'次'
FrmDutyQueryed.showModal;
end
else
Application.MessageBox('没有找到相应的出勤记录!','系统提示');
end;
end;end;错误是[Error] Umain.pas(37): Type of expression must be BOOLEAN
[Error] Umain.pas(67): Missing operator or semicolon
[Error] Umain.pas(76): Declaration expected but end of file found
[Fatal Error] CompDuty.dpr(7): Could not compile used unit 'Umain.pas'
+IntToStr(RecordCount)+'次'后面少了分号
最后可能少了end
FrmDutyQueryed.LblQuery.Caption:='查询结果:出勤'
+IntToStr(RecordCount)+'次'
后面少了分号