ADOQuery1.Close;
     ADOQuery1.SQL.Clear;
     s:='delete from a04t where velconditioncode is null and velconditionname is null and value is null and normal is null and abnormal is null and resoncode is null and reson is null';
     ADOQuery1.SQL.Add(s);
     ADOQuery1.execsql;     ADOQuery1.Close;
     ADOQuery1.SQL.Clear;
     s:='delete from a05t where specialoperationcode is null and specialoperationname is null and f20 is null and f40 is null and e20 is null and e40 is null and resoncode is null and reson is null';
     ADOQuery1.SQL.Add(s);
     ADOQuery1.execsql;
ADOQuery1.Close;        
     ADOQuery1.SQL.Clear;
     s:='insert into a01 select id,callsign,MV,voy,port,date,re from a01t';
     ADOQuery1.SQL.Add(s);
     ADOQuery1.ExecSQL;
在调试的时候,前面两段代码没有反应,没有删掉空数据,但是最后那一段代码起作用了,这3段代码在一个按钮中,是连在一起的,是不是有影响啊?请指教!

解决方案 »

  1.   

    是不是不能用同一个query阿?
      

  2.   

    没有影响~~~应该是你前两个SQL语句中,没有符合你的 where 条件,所以没有删除记录
      

  3.   

    程序没有问题,WHERE条件不满足.
      

  4.   

    你把这条SQL拿到查询里执行一下看看有没效果就清楚啦.
      

  5.   

    这样的删除,你可以写个存储过程,
    应该是条件不满足,与几个adoquery无关。
      

  6.   

    showmessage(inttostr(length(adotable3.FieldByName('value').AsString)));
         showmessage(inttostr(length(adotable3.FieldByName('normal').AsString)));
         showmessage(inttostr(length(adotable3.FieldByName('abnormal').AsString)));     ADOQuery1.Close;
         ADOQuery1.SQL.Clear;
         s:='delete from a04t where len(normal)=0 and len(abnormal)=0';
         ADOQuery1.SQL.Add(s);
         ADOQuery1.execsql;
    showmessage返回的值都是0,可是就是不能执行删除,在数据库里也不能执行。怎么回事啊,看不出表里有数据阿。