var
no:string;
begin
  no:=listview1.Items[listview1.Selected.Index].Caption;
  with query1 do
   begin 
     close;
     sql.clear;
     sql.add('delete from station where sation_id:='+''''+no+'''');
      execsql;
   end;
上面是我代码,但是执行到删除语句时报错:
query1.field='1'if of unknow  type
这究竟是什么原因?

解决方案 »

  1.   

    改成这样试试?
    SQL.Add('DELETE FROM Station WHERE (Station_ID = "'+no+'"'));
      

  2.   

    begin 
         close;
         sql.clear;
         sql.add('delete from station where sation_id ='''+no+'''');
         execsql;
       end;
      

  3.   

    sql.add('delete from station where sation_id:='+''''+no+'''');DELPHI中的是SQL语句是不用冒号等于的,应该改为
    sql.add('delete from station where sation_id = '+''''+no+'''');
      

  4.   

    var
     str:string;begin 
         str:='delete from station where sation_id ='''+no+'''';
         close;
         sql.clear;
         sql.add(str);
         execsql;
       end;
      

  5.   

    sql.add('delete from station where sation_id='''+no+'''');
      

  6.   

    sql.add('delete from station where sation_id:='+''''+no+'''');
    改为
    sql.add('delete from station where sation_id='''+no+'''');
      

  7.   

    支持things(平) (枕流以洗耳,漱石以磨牙) 和 symsss(大明)