大侠好!
为何这段语句:
if query1.fields[0].value<>null.....
在delphi7中编译有误,而在delphi5中可以编译成功呢?
delphi7提示错误为:Undeclared identifier: 'null'
还请高手指点阿!
谢谢!

解决方案 »

  1.   

    if query1.fields[0].IsNull then 
    ...
      

  2.   

    那不为空就是:
    query1.fields[0].isnotnull....?
      

  3.   

    if not query1.fields[0].IsNull then 
    ...
      

  4.   

    huangrx(一水寒) : 
      只有Fields[0].IsNull,没有IsNotNull, 如果你要使用NULL,请先
    Use "Variants"这个单元.
      

  5.   

    delphi的NULL用NIL关键字表示
    但是delphi的NIL和c的NULL有区别
    c的NULL表示NULL表示0表示""
    但是delphi的NIL就是NIL,不能表示0不能表示''
    你应该用query1.fields[0].IsNull   NIL不能用=符号比较但是可以:=负值void __fastcall func () {
        TButton * MyButton;
        MyButton = new TButton(NULL);
        ...
        delete MyButton;
    }换成delphi就是procedure func ();
    var
        MyButton: TButton;
    begin
        MyButton := TButton.Create(NIL);
        ...
        MyButton.Free;
        MyButton := NIL; //彻底释放
    end;
      

  6.   

    delphi当然不支持NULL了,delphi支持的是NIL  哈哈
    除非
    type
      NULL = NIL;