procedure THolidayRequisitionForm.SaveBtnClick(Sender: TObject);
var
csql,csql2:string;
begin
csql2:='select * from holidayReq where deptNo='+quotedstr(trim(deptNocbm.text));
csql2:=csql2+' and empNo='+quotedstr(trim(EmpNocbm.text))+' and startTime='+quotedstr(trim(StartTimeEdt.text));
with udm.Qry_holidayReq do
begin
close;
sql.Clear;
sql.Add(csql2);
open;
end;
if udm.Qry_holidayReq.RecordCount>0 then
begin
application.MessageBox('本次请假开始时间已经存在!','提示',0+64);
exit;
end;
try
csql:='insert into holidayReq (deptNo,deptName,empNo,empName,holidayNo,holidayName,StartTime,EndTime,checkFlag,reMark) values ';
csql:=csql+ '('+quotedstr(trim(deptNocbm.text))+','+quotedstr(trim(deptNameEdt.Text)) + ','+ quotedstr(trim(empNOcbm.Text))+',';
csql:=csql +quotedstr(trim(empNameEdt.text))+','+quotedstr(trim(holidayNoCbm.text))+','+QUOTEDSTR(trim(holidayNameEdt.text));
csql:=csql+ ','+quotedstr(startTimeEdt.text)+ ','+ quotedstr(endTimeEdt.Text)+','+'0'+','+quotedstr(remarkEdt.text) +')';
with udm.qry_holiday do
begin
close;
sql.Clear;
sql.Add(CSQL);
execSQL;
end;
showMessage('保存成功');
except
showMessage('保存失败。');
exit;
end;
//显示
with udm.Qry_holidayReq do
begin
close;
sql.Clear;
sql.Add('select * from holidayReq where deptNo ='+quotedstr(trim(deptNOCbm.Text))+' and startTime='+quotedstr(trim(startTimeEdt.text)) );
open;
end;
end;
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/729024/viewspace-564880/ ,如需转载,请注明出处,否则将追究法律责任。