在delphi中 if qy1.FieldByName('sh').curValue is null then
提示错误,请问在delphi中该如何判断是否为null值?

解决方案 »

  1.   

    两种方法吧:
    1. if assigned(qy1.FieldByName('sh').curValue) then2. if qy1.FieldByName('sh').curValue = nil then
      

  2.   


      if (qy1.FieldByName('sh').curValue<>qy1.FieldByName('sh').NewValue) or (assigned(qy1.FieldByName('sh').curValue)) then提示incompatible types
      

  3.   

    if Query.FieldByName('Name').IsNull then
    ...
      

  4.   

    应该为
    qy1.FieldByName('sh').newvalue=Null
    谢谢大家。
      

  5.   

    看到这么多人顶了一个“CurValue = nil”的回复,就觉得很好笑,你们真的知道这个属性是什么类型吗?5楼才是正解,或者用下面的函数,这个函数是专门判断变体是不是NULL的
    if VarIsNull(qy1.FieldByName('sh').curValue) then
      

  6.   

    标准答案:
    if qy1.FieldByName('sh').IsNull then
      

  7.   

    寡人常用如下方法if Query.FieldByName('Name').IsNull then