sql:
select * from renzhen where ((sj_stoptime >#2005-9-19 22:11:02#) and (sj_starttime < #2005-9-19 24:11:02#))delphi自动把时间带上了日期, 在比较时间时用以上的sql无法用. 请问有什么好方法比较时间.
select * from renzhen where ((sj_stoptime >#2005-9-19 22:11:02#) and (sj_starttime < #2005-9-19 24:11:02#))delphi自动把时间带上了日期, 在比较时间时用以上的sql无法用. 请问有什么好方法比较时间.
function SearchFile(const mainpath:string;filename:string;var foundresult:TStrings):Boolean;
var
i:integer;
Found:Boolean;
subdir1:TStrings;
searchRec:TsearchRec;
SR : TSearchRec;
begin
found:=false;
if Trim(filename)<>'' then
begin
if FindFirst(mainpath+filename,faDirectory,sr)=0 then
repeat
begin
found:=true;
foundresult.Add(mainpath+SR.Name);
end
until FindNext(sr)<>0;
FindClose(SR); if FindFirst(mainpath+'*.*', faDirectory, SearchRec)=0 then
begin
while FindNext(SearchRec) = 0 do
begin
if SearchRec.Name<>'..' then
begin
found := SearchFile(mainpath+SearchRec.Name+'\',Filename,foundresult)or found;
end;
end;
end;
FindClose(SearchRec);
end;
result:=Found;
end;
转换一下
vsql : string;
begin
vsql := ‘select * from renzhen where ((sj_stoptime >#‘+formatdatetime('yyyy-mm-dd','2005-9-19 22:11:02')+'#) and (sj_starttime < #'+formatdatetime('yyyy-mm-dd 23:59:59','2005-9-19 24:11:02')+'#))';
adoquery.sql.text := vsql;
adoquery.open;
end;