if lkform.RadioButton1.checked=true and radiobutton1.checked=true then
         begin
         adoquery1.Close;
         adoquery1.sql.Clear;
         adoquery1.sql.Add('update suppy_info');
         adoquery1.sql.Add('set suppy_number=suppy_number+'-lkform.edit3.text+edit3.text);
         adoquery1.sql.Add('from suppy_info,jc_details');
        //sql.Add('where jc_details.jc_state=''进''');
         adoquery1.sql.Add('and suppy_info.suppy_id='+''''+edit1.Text+'''');
         adoquery1.execsql;
         end;
       if  lkform.RadioButton2.checked=true and radiobutton2.checked=true then
         begin
         adoquery1.Close;
         adoquery1.sql.Clear;
         adoquery1.sql.Add('update suppy_info');
         adoquery1.sql.Add('set suppy_number=suppy_number+'+lkform.edit3.text-edit3.text);
         adoquery1.sql.Add('from suppy_info,jc_details');
         adoquery1.sql.Add('and suppy_info.suppy_id='+''''+edit1.Text+'''');
         adoquery1.execsql;
          end;
       if  lkform.RadioButton1.checked=true and radiobutton2.checked=true then
         begin
         adoquery1.Close;
         adoquery1.sql.Clear;
         adoquery1.sql.Add('update suppy_info');
         adoquery1.sql.Add('set suppy_number=suppy_number+'-lkform.edit3.text-edit3.text);
         adoquery1.sql.Add('from suppy_info,jc_details');
         adoquery1.sql.Add('and suppy_info.suppy_id='+''''+edit1.Text+'''');
         adoquery1.execsql;
         end;
       if  lkform.RadioButton2.checked=true and radiobutton1.checked=true then
         begin
         adoquery1.Close;
         adoquery1.sql.Clear;
         adoquery1.sql.Add('update suppy_info');
         adoquery1.sql.Add('set suppy_number=suppy_number+'+lkform.edit3.text+edit3.text);
         adoquery1.sql.Add('from suppy_info,jc_details');
         adoquery1.sql.Add('and suppy_info.suppy_id='+''''+edit1.Text+'''');
         adoquery1.execsql;
         end;
错误提示:Build
  [Error] Unit4.pas(146): Operator not applicable to this operand type
  [Error] Unit4.pas(157): Operator not applicable to this operand type
  [Error] Unit4.pas(167): Operator not applicable to this operand type
  [Error] Unit4.pas(167): Operator not applicable to this operand type
  [Fatal Error] Project1.dpr(8): Could not compile used unit 'Unit4.pas'

解决方案 »

  1.   

             adoquery1.sql.Add('set suppy_number=suppy_number+'-lkform.edit3.text+edit3.text);
    不能有减号,字符串可以用+好连接但是不能用  -  号减,-  号使用有问题
      

  2.   

    //估计你是要这个if lkform.RadioButton1.checked=true and radiobutton1.checked=true then
             begin
             adoquery1.Close;
             adoquery1.sql.Clear;
             adoquery1.sql.Add('update suppy_info');
             adoquery1.sql.Add('set suppy_number=suppy_number+'+inttostr(strtoint(edit3.text)-strtoint(lkform.edit3.text))+' ');
             adoquery1.sql.Add('from suppy_info,jc_details');
            //sql.Add('where jc_details.jc_state=''进''');
             adoquery1.sql.Add('and suppy_info.suppy_id='+''''+edit1.Text+'''');
             adoquery1.execsql;
             end;
           if  lkform.RadioButton2.checked=true and radiobutton2.checked=true then
             begin
             adoquery1.Close;
             adoquery1.sql.Clear;
             adoquery1.sql.Add('update suppy_info');
             adoquery1.sql.Add('set suppy_number=suppy_number+'+inttostr(strtoint(lkform.edit3.text)-strtoint(edit3.text)));
             adoquery1.sql.Add('from suppy_info,jc_details');
             adoquery1.sql.Add('and suppy_info.suppy_id='+''''+edit1.Text+'''');
             adoquery1.execsql;
              end;
         //后面的用类似的方法改掉
      

  3.   

    楼上说的是其中一个问题.
    还有4个:
             adoquery1.sql.Add('from suppy_info,jc_details'); 
             adoquery1.sql.Add('and suppy_info.suppy_id='+''''+edit1.Text+''''); 这里边实际上相当于这样:adoquery1.sql.Add('from suppy_info,jc_details and suppy_info.suppy_id='+''''+edit1.Text+''''); 
    语法不通吧?
      

  4.   

    if lkform.RadioButton1.checked=true and radiobutton1.checked=true then 
    if  lkform.RadioButton2.checked=true and radiobutton2.checked=true then 
    if  lkform.RadioButton1.checked=true and radiobutton2.checked=true then 
    if  lkform.RadioButton2.checked=true and radiobutton1.checked=true then 
    这些都错了,要加上括号,True可以省略去...if (lkform.RadioButton1.checked) and (radiobutton1.checked) then 
    if (lkform.RadioButton2.checked) and (radiobutton2.checked) then
    if (lkform.RadioButton1.checked) and (radiobutton2.checked) then
    if (lkform.RadioButton2.checked) and (radiobutton1.checked) then 
      

  5.   

    if lkform.RadioButton1.checked=true and radiobutton1.checked=true then 
    if  lkform.RadioButton2.checked=true and radiobutton2.checked=true then 
    if  lkform.RadioButton1.checked=true and radiobutton2.checked=true then 
    if  lkform.RadioButton2.checked=true and radiobutton1.checked=true then 
    这些都错了,要加上括号,True可以省略去...if (lkform.RadioButton1.checked) and (radiobutton1.checked) then 
    if (lkform.RadioButton2.checked) and (radiobutton2.checked) then
    if (lkform.RadioButton1.checked) and (radiobutton2.checked) then
    if (lkform.RadioButton2.checked) and (radiobutton1.checked) then 
      

  6.   

    你的错误提示就是提示这些if ... and ... then 错误的...
      

  7.   

    if lkform.RadioButton1.checked=true and radiobutton1.checked=true then
    改成
    if lkform.RadioButton1.checked and radiobutton1.checked then
      

  8.   

    用这个改还是有错~~
    if (lkform.RadioButton1.checked) and (radiobutton1.checked) then 
    if (lkform.RadioButton2.checked) and (radiobutton2.checked) then
    if (lkform.RadioButton1.checked) and (radiobutton2.checked) then
    if (lkform.RadioButton2.checked) and (radiobutton1.checked) then 用了2楼同志的改了,也还是错滴~~~~~~`我个人觉得: 错误应该在这边:adoquery1.sql.Add('set suppy_number=suppy_number+'-lkform.edit3.text-edit3.text);提示的错误:  [Error] Unit4.pas(167): Operator not applicable to this operand type
      [Fatal Error] Project1.dpr(8): Could not compile used unit 'Unit4.pas'
      

  9.   

    以下4行:         adoquery1.sql.Add('update suppy_info'); 
             adoquery1.sql.Add('set suppy_number=suppy_number+'+lkform.edit3.text-edit3.text); 
             adoquery1.sql.Add('from suppy_info,jc_details'); 
             adoquery1.sql.Add('and suppy_info.suppy_id='+''''+edit1.Text+''''); 执行之后应该是(注意红色部分):
    ADOQuery1.SQL.Text=''update suppy_info set suppy_number=suppy_number+'+lkform.edit3.text-edit3.text from suppy_info,jc_details and suppy_info.suppy_id='''+edit1.Text+'''';
    这里似乎少了一个Where关键字;
    还有:
    suppy_number=suppy_number+'+lkform.edit3.text-edit3.text 
    这一句引号外边应该返回的是数字型,那么:
    suppy_number=suppy_number+'+IntToStr(StrToInt(lkform.edit3.text-StrToInt(lkform.edit3.text))
    试着修改上边两处地方后再执行
      

  10.   

      [Error] Unit4.pas(146): Operator not applicable to this operand type 
    if () AND () then
      

  11.   


           if (lkform.RadioButton1.checked=true) and (radiobutton1.checked=true) then 
             begin 
             adoquery1.Close; 
             adoquery1.sql.Clear; 
             adoquery1.sql.Add('update suppy_info'); 
             adoquery1.sql.Add('set suppy_number=suppy_number+'+ IntToSr(StrToInt(edit3.text)-StrToInt(lkform.edit3.text))); 
             adoquery1.sql.Add('from suppy_info,jc_details'); 
            //sql.Add('where jc_details.jc_state=''进'''); 
             adoquery1.sql.Add('and suppy_info.suppy_id='+''''+edit1.Text+''''); 
             adoquery1.execsql; 
             end; 
           if  (lkform.RadioButton2.checked=true) and (radiobutton2.checked=true) then 
             begin 
             adoquery1.Close; 
             adoquery1.sql.Clear; 
             adoquery1.sql.Add('update suppy_info'); 
             adoquery1.sql.Add('set suppy_number=suppy_number+'+ IntToSr(StrToInt(lkform.edit3.text)-StrToInt(edit3.text))); 
             adoquery1.sql.Add('from suppy_info,jc_details'); 
             adoquery1.sql.Add('and suppy_info.suppy_id='+''''+edit1.Text+''''); 
             adoquery1.execsql; 
              end; 
           if  (lkform.RadioButton1.checked=true) and (radiobutton2.checked=true) then 
             begin 
             adoquery1.Close; 
             adoquery1.sql.Clear; 
             adoquery1.sql.Add('update suppy_info'); 
             adoquery1.sql.Add('set suppy_number=suppy_number-'+ IntToSr(StrToInt(lkform.edit3.text)+StrToInt(edit3.text))); 
             adoquery1.sql.Add('from suppy_info,jc_details'); 
             adoquery1.sql.Add('and suppy_info.suppy_id='+''''+edit1.Text+''''); 
             adoquery1.execsql; 
             end; 
           if  (lkform.RadioButton2.checked=true) and (radiobutton1.checked=true) then 
             begin 
             adoquery1.Close; 
             adoquery1.sql.Clear; 
             adoquery1.sql.Add('update suppy_info'); 
             adoquery1.sql.Add('set suppy_number=suppy_number+'+ IntToSr(StrToInt(lkform.edit3.text)+StrToInt(edit3.text))); 
             adoquery1.sql.Add('from suppy_info,jc_details'); 
             adoquery1.sql.Add('and suppy_info.suppy_id='+''''+edit1.Text+''''); 
             adoquery1.execsql; 
             end; 
      

  12.   

    老实说楼主的代码比较拖沓,想下面改一下吧(Format的函数你自己看一下吧):
    var
      S: string; //定义一个变量吧
    begin
      S := '';
      if lkform.RadioButton1.checked = true and radiobutton1.checked = true then
        S := Format('set suppy_number=suppy_number-%s+%s', [lkform.edit3.text, edit3.text]);
      if lkform.RadioButton2.checked = true and radiobutton2.checked = true then
        S := Format('set suppy_number=suppy_number+%s-%s', [lkform.edit3.text, edit3.text]);
      if lkform.RadioButton1.checked = true and radiobutton2.checked = true then
        S := Format('set suppy_number=suppy_number-%s-%s', [lkform.edit3.text, edit3.text]);
      if lkform.RadioButton2.checked = true and radiobutton1.checked = true then
        S := Format('set suppy_number=suppy_number+%s+%s', [lkform.edit3.text, edit3.text]);
      if S <> '' then
      begin
        adoquery1.Close;
        adoquery1.sql.Clear;
        adoquery1.sql.Add('update suppy_info');
        adoquery1.sql.Add(S);
        adoquery1.sql.Add('from suppy_info,jc_details');
        adoquery1.sql.Add('and suppy_info.suppy_id=' + '''' + edit1.Text + '''');
        adoquery1.execsql;
      end;
    end;