var
  Custpono,Refno:string;
 
  Custpono:=Trim(Form1.CPNbox.text);
  Refno:=AdoExcel.Fields[0].value;if (Custpono=Form1.AdoCtmQry.Fields[0].asstring) 
     and (Refno=Form1.AdoCtmQry.Fields[1].asstring) then
     showmessage('old')
     else
     showmessage('new');
在上面语句中,明明我的判断条件是对的,他却去执行'new'部分,当我把'new'部分去掉他就可以执行正确的语句'old'?真是奇怪,还从没遇到这种问题,望指点....谢谢...

解决方案 »

  1.   

    你先把你的判断语句的值取出来试试看.
    s1:=Form1.AdoCtmQry.Fields[0].asstring;
    s2:=Form1.AdoCtmQry.Fields[1].asstring;
    if (Custpono=s1) and (Refno=s2) then
       showmessage('old')
    else
       showmessage('new');
      

  2.   

    if ((Custpono=Form1.AdoCtmQry.Fields[0].asstring) and (Refno=Form1.AdoCtmQry.Fields[1].asstring)) then
         begin
            showmessage('old')
         end
         else
         begin
           showmessage('new');
         end;
      

  3.   

    哎,刚才还可以将数据导入到Excel中的.突然间现在又导不进去了.抱什么键列信息不足!..