procedure TFrmSyst_Code_Hand.fromshow;
var
 BID,WHID:integer;
 RID:integer;
begin
  Rid:=12;
  BID:=12;
  WHID:=1;
   with dm_code.QrySystCode_Hand do
     begin
        close;
        sql.Clear;
        //sql.add('select * from syst_Code_hand where resid=%D and BillID='%s' and WareHouseID=%D',[Rid,BID,WHID]);
       sql.Add(format('selcet * from syst_Code_hand where resid=%D  and BillID=''%S''  and WareHouseID=%D ,[Rid,BID, WHID]));
        Open;
        Active:=true;
      end;
      while not dm_code.QrySystCode_Hand.Eof do
      begin
           LstBxCode_hand.Items.Add(dm_code.QrySystCode_Hand.fieldbyname('codeID').AsString);
           dm_code.QrySystCode_Hand.Next;
      end;end;
上米那的过程市我在onshow事件里用的。sql语句那错了。怎么办。马上结贴。

解决方案 »

  1.   

    sql.Add(format('selcet * from syst_Code_hand where resid=''%D''  and BillID=''%S''  and WareHouseID=''%D'' ,[Rid,BID, WHID]'));
      

  2.   

    sql.Add(format('selcet * from syst_Code_hand where resid=%D  and BillID=''%S''  and WareHouseID=%D ,[Rid,BID, WHID]));这句不知道是不是你写错了,反正应该是这样的
    sql.Add(format('selcet * from syst_Code_hand where resid=%D  and BillID=''%S''  and WareHouseID=%D',[Rid,BID, WHID]));不行的话,你再发消息
      

  3.   

    //sql.add('select * from syst_Code_hand where resid=''%D'' and BillID=''%s'' and WareHouseID=''%D''');
      

  4.   

    我靠,第一次发了还出错,有没有搞错啊
    sql.Add(format('selcet * from syst_Code_hand where resid=%D  and BillID=''%S''  and WareHouseID=%D ,[Rid,BID, WHID]));
    这一句有点问题,
    sql.Add(format('selcet * from syst_Code_hand where resid=%D  and BillID=''%S''  and WareHouseID=%D',[Rid,BID, WHID]));
    少了一个分号
      

  5.   

    倒 引号都不对应阿
    sql.Add(format('selcet * from syst_Code_hand where resid=''%D''  and BillID=''%S''  and WareHouseID=''%D''' ,[Rid,BID, WHID]));
      

  6.   

    在Delphi中,单引号之间要想再插入单引号的话,必须用两个单引号来表示一个单引号。