sql.add('Select * From old.db Where (date3 between :stratdate and :enddate) '); ParamByName('stratdate').asdate:= StrToDate(date1); ParamByName('enddate').asdate:= StrToDate(date2);
// SearchStartTime和SearchEndTime是输入的MaskEdit编辑框 // IO_TIME是数据库表中的TimeStamp格式 // 下面程序如何改啊?数据库显示是用DBGrid控件来做的 // 多谢各位了 with dm_main.T_attendance do begin cond := ''; Close; if SeekByPerson.Checked then // 选中按员工找 cond := 'PERSON=''' + SearchPersonID.Text + ''''; if SeekByTime.Checked then // 选中按时间范围找 begin if length( cond ) >0 then // 两个条件可以是AND与的关系 cond := cond + ' AND '; cond := cond + 'IO_TIME >=''' + SearchStartTime.Text + ''''; cond := cond + 'AND IO_TIME <= ''' + SearchEndTime.Text + ''''; end; if length( cond )>0 then begin filter := cond; filtered := True; // 选了检索条件 end else filtered := False; // 没有选检索条件 Open;
ParamByName('stratdate').asdate:= StrToDate(date1);
ParamByName('enddate').asdate:= StrToDate(date2);
// IO_TIME是数据库表中的TimeStamp格式
// 下面程序如何改啊?数据库显示是用DBGrid控件来做的
// 多谢各位了
with dm_main.T_attendance do
begin
cond := '';
Close;
if SeekByPerson.Checked then // 选中按员工找
cond := 'PERSON=''' + SearchPersonID.Text + '''';
if SeekByTime.Checked then // 选中按时间范围找
begin
if length( cond ) >0 then // 两个条件可以是AND与的关系
cond := cond + ' AND ';
cond := cond + 'IO_TIME >=''' + SearchStartTime.Text + '''';
cond := cond + 'AND IO_TIME <= ''' + SearchEndTime.Text + '''';
end;
if length( cond )>0 then
begin
filter := cond;
filtered := True; // 选了检索条件
end
else
filtered := False; // 没有选检索条件
Open;