adodm.qry_temp.Close;
  adodm.qry_temp.SQL.Clear;
  adodm.qry_temp.SQL.Add('delete from empresult where res_date<=:enddate and res_date>=:stardate');
  if trim(ComboBox1.Text)<>''then
    begin
      adodm.qry_temp.SQL.Add('and res_empno in (select emp_num from per where dept_name=:vdept)');
      adodm.qry_temp.Parameters.ParamByName('vdept').Value :=ComboBox1.Text;
    end;
 if trim(edit4.Text)<>'' then
    begin
      adodm.qry_temp.SQL.Add('and res_empno =:vempno');
      adodm.qry_temp.Parameters.ParamByName('vempno').Value :=edit4.Text ;
    end;
  //adodm.qry_temp.SQL.Add('and res_date<=:enddate and res_date>=:stardate');
  adodm.qry_temp.Parameters.ParamByName('enddate').Value :=enddate;
  adodm.qry_temp.Parameters.ParamByName('stardate').Value :=stardate;
  //adodm.qry_temp.Parameters.ParamByName('vdata').Value:=maskedit1.text;
  adodm.qry_temp.Prepared ;
  adodm.qry_temp.ExecSQL ;跟踪到的是
exec sp_executesql N'delete from empresult where res_date<=@P1 and res_date>=@P2
and res_empno =@P3
', N'@P1 datetime,@P2 datetime,@P3 varchar(8)', '07 17 2004 12:00:00:000AM', '07 17 2004 12:00:00:000AM', '0010047'
              var i:=date;
              adodm.qry_temp.Close ;
              adodm.qry_temp.SQL.Clear ;
              //adodm.qry_temp.SQL.Add('declare @int1 int =0');
              //adodm.qry_temp.SQL.add
              adodm.qry_temp.SQL.Add('insert  empresult (res_empno,res_empname,res_date,res_result)');
              adodm.qry_temp.SQL.Add('select emp_num,emp_name,:v@date,:v@int1 from per  where emp_num is not null');
              adodm.qry_temp.Parameters.ParamByName('v@date').Value :=i-2; /////于delphi中差两天注意!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
              adodm.qry_temp.Parameters.ParamByName('v@int1').Value :=re;
              if trim(combobox1.Text) <>'' then
                begin
                  adodm.qry_temp.SQL.Add('and dept_name =:vdept');
                  adodm.qry_temp.parameters.ParamByName('vdept').Value :=combobox1.Text ;
                end;
              if trim(edit4.Text) <>'' then
                begin
                  adodm.qry_temp.SQL.Add('and emp_num =:vempno');
                  adodm.qry_temp.Parameters.ParamByName('vempno').Value :=edit4.Text ;
                end;
              qry_temp.ExecSQL ;;
跟踪到的是 
exec sp_executesql N'insert  empresult (res_empno,res_empname,res_date,res_result)
select emp_num,emp_name,@P1,@P2 from per  where emp_num is not null
and emp_num =@P3
', N'@P1 float,@P2 int,@P3 varchar(7)', 3.818300000000000e+004, 0, '0010047'两次的时间差两天?????????????????????????????????