H
hnzcg124
Unregistered / Unconfirmed
GUEST, unregistred user!
代码:
var sb,da1,da2:string;
begin
case dayofweek(date) of
1: begin
sb:='1899-12-24';
da1:=datetimetostr(date+strtodatetime(sb));
clientdataset1.Close;
clientdataset1.CommandText:='select * from sb_rcxhjcgl where xjsj>='+''''+da1+'''';
clientdataset1.Open;//sunday
end;
2: begin
sb:='1899-12-30';
da2:=datetimetostr(date+strtodatetime(sb));
clientdataset1.Close;
clientdataset1.CommandText:='select * from sb_rcxhjcgl where xjsj>='+''''+da2+'''';
clientdataset1.Open;
end;//monday
3: begin
sb:='1899-12-29';
da:=datetimetostr(date+strtodatetime(sb));
clientdataset1.Close;
clientdataset1.CommandText:='select * from sb_rcxhjcgl where xjsj>='+''''+da+'''';';
clientdataset1.Open;//tuesday
end;
4: begin
sb:='1899-12-28';
da:=datetimetostr(date+strtodatetime(sb));
clientdataset1.Close
clientdataset1.CommandText:='select * from sb_rcxhjcgl where xjsj>='+''''+da+'''';';
clientdataset1.Open;//wednesday
end;
5: begin
sb:='1899-12-27';
da:=datetimetostr(date+strtodatetime(sb));
clientdataset1.Close;
clientdataset1.CommandText:='select * from sb_rcxhjcgl where xjsj>='+''''+da+'''';';
clientdataset1.Open;
end;//thursday
6: begin
sb:='1899-12-26';
da:=datetimetostr(date+strtodatetime(sb));
clientdataset1.Close;
clientdataset1.CommandText:='select * from sb_rcxhjcglwhere xjsj>='+''''+da+'''';';
clientdataset1.Open
end;//friday
7: begin
sb:='1899-12-25';
da2:=datetimetostr(date+strtodatetime(sb));
clientdataset1.Close;
clientdataset1.CommandText:='select * from sb_rcxhjcgl where xjsj>='+''''+da+'''';';
clientdataset1.Open;
end;//statusday
end;
end;//以上为根据本周记录,提取系统时间得出星期几来查找
这是原来公司老员工做周查询,我觉得应该有更简单的方法,怎么实现呢?还有他这里面查询看不懂,按说1 23等只是对应的是一天的呀?????