adoquery2.Close;
adoquery2.SQL.Clear;
adoquery2.SQL.Add('select * from 记录 where 编号='+ ''''+a1.Text+'''' +'and 日期='+ ''''+a6.Text+''''+'and 班次='+ ''''+a8.Text+'''');
adoquery2.Open;
if ADOQuery2.RecordCount=0 then
exit
else
下班时间字段用当前时间替换

解决方案 »

  1.   

    with AdoQuery1 do
      begin
        Close;
        SQL.Clear;
        SQL.Add('update 记录 set 下班时间=:xTime');
        Parameters[0].value:=Now;
        ExecSQL;
      end;
      

  2.   

    with AdoQuery1 do
      begin
        Close;
        SQL.Clear;
        SQL.Add('update 记录 set 下班时间=:xTime');
        Parameters.ParamByName('xTime').Value := Now;
        //Parameters.ParamValues['xTime'] := Now; //这样也可以
        ExecSQL;
        Close;
      end;
      

  3.   

    with AdoQuery1 do
      begin
        Close;
        SQL.Clear;
        SQL.Add('update 记录 set 下班时间=:Time');
        Parameters[0].value:=Now;
        ExecSQL;
      end;