注册 登录
编程论坛 Delphi论坛

[求助]这句是什么意思?

chenfei20018 发布于 2007-05-14 17:17, 569 次点击
procedure Tfrm_yjb.ShowGrid;
Var
S: String;
Const
MySQL = 'select CardID, stuffname, BrchName, CardTime, CASE kqFlag WHEN 0 THEN ''正常'' WHEN 1 THEN ''迟到'' '
+ 'WHEN 2 THEN ''早退'' END FROM kqview WHERE CardTime >= ''%S'' AND CardTime <= ''%S''';
begin
S := Format(MySQL, [FormatDateTime('yyyy-mm-dd', dtFrom.Date), FormatDateTime('yyyy-mm-dd', dtTo.Date)]); //这句是什么意思啊???
ChangeDatasource(S, 0);
end;
1 回复
#2
anthony6342007-05-14 17:34

格式化字符串,
MySQL = 'select CardID, stuffname, BrchName, CardTime, CASE kqFlag WHEN 0 THEN ''正常'' WHEN 1 THEN ''迟到'' '
+ 'WHEN 2 THEN ''早退'' END FROM kqview WHERE CardTime >= ''%S'' AND CardTime <= ''%S''';
第一个%s:dtFrom.Date
第二个%s:dtTo.Date
FormatDateTime 同理是格式化日期类型

1