免
免费地铁
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TfrmCheckS.Count(Ado1:TADOQuery;edt,com,tim:string; var edt2: Tedit);
begin
with Ado1 do
begin
Close;
SQL.Clear;
SQL.Add('select count(MSWork) as Mstar from tbDutyRecord where'+
' Ltrim(Rtrim(StaffID)) ='''+edt+''' and DatePart(hour,MSWork)>'''+tim+''''+
' and DatePart(month,counttime)= '''+com+'''');
Open;
edt2.Text:= FieldByName('Mstar').AsString;
end;
end;
procedure TfrmCheckS.bitCountClick(Sender: TObject);
begin
Count(ADOCount1,edtID.Text,'7',comMonth.text,edtLate);
end;
上面是我写的一个过程,和调用,可是这样的结果在 edtLate上显示的是0,但是真正表中的记录不是0
而我要是只判断 DatePart(hour,MSWork)>'''+tim+''' (上班时间)
或只判断 and DatePart(month,counttime)= '''+com+'''(统计的月份) 这样的话edtLate上就能显示出记录来,
可是符合(上班时间)和(统计的月份)的记录是相同的啊?
是不是不能同时用两个DatePart?
begin
with Ado1 do
begin
Close;
SQL.Clear;
SQL.Add('select count(MSWork) as Mstar from tbDutyRecord where'+
' Ltrim(Rtrim(StaffID)) ='''+edt+''' and DatePart(hour,MSWork)>'''+tim+''''+
' and DatePart(month,counttime)= '''+com+'''');
Open;
edt2.Text:= FieldByName('Mstar').AsString;
end;
end;
procedure TfrmCheckS.bitCountClick(Sender: TObject);
begin
Count(ADOCount1,edtID.Text,'7',comMonth.text,edtLate);
end;
上面是我写的一个过程,和调用,可是这样的结果在 edtLate上显示的是0,但是真正表中的记录不是0
而我要是只判断 DatePart(hour,MSWork)>'''+tim+''' (上班时间)
或只判断 and DatePart(month,counttime)= '''+com+'''(统计的月份) 这样的话edtLate上就能显示出记录来,
可是符合(上班时间)和(统计的月份)的记录是相同的啊?
是不是不能同时用两个DatePart?