我以前用过:
设为空:FieldByName(字段名).Value := null;
判断:if FieldByName(字段名).IsNull then ...

解决方案 »

  1.   

    if table1.Fields[4].Value='' then
      showmessage('yes')
      else
      begin
      table1.Edit ;
      table1.Fields[4].Value :='';
      table1.Post ;
      end;
      

  2.   

    天哪,怎么办,我用clear,null,nil,'',全部试过,还是没用,字段里还是不为空,无法判断
    请高手门关注一下
      

  3.   

    我刚才随便找了个Delphi的Demo试了一下,可以得啊。就是这样:
      Table1.Edit;
      Table1Graphic.Clear;
      Table1.Post;
      

  4.   

    用什么方法判断是否为空?
    isnull 还是=nil
      

  5.   

    奇怪了,我试过没有用的,我用watch窗口监视,初始的字段值为'',载如数据后再执行了clear方法后字段的值没有变成'',所以判断不出来
      

  6.   

    显示为'',并不意味着IsNull一定是False啊。我刚才试了,好用的。procedure TForm1.Button1Click(Sender: TObject);
    begin
      Table1.Edit;
      Table1Graphic.Clear;
      Table1.Post;
    end;procedure TForm1.Button2Click(Sender: TObject);
    begin
    if Table1Graphic.IsNull then
        ShowMessage('Hello, world!');
    end;
      

  7.   

    我晕了晕了
    还是不行啊,我试了n次了,我用的是adoquery
      if OleContainer1.State = osEmpty then
      begin
        adoquery1.Edit;
        ADOQuery1DSDesigner1.Clear;  //经过调试,当olecontainerl为空的时候可以执行这一句
        adoquery1.Post;
      end
      else begin
        m := TMemoryStream.Create;
        OleContainer1.SaveToStream(m);
        m.Position := 0;
        adoquery1.Insert;
        TBlobField(adoquery1.fieldbyname('1')).LoadFromStream(m);
        adoquery1.Post;
      end;用这个清空ole控件
      OleContainer1.DestroyObject;判断是这样
      if ADOQuery1DSDesigner1.IsNull then
        showmessage('null')
      else
        showmessage('blob') 除了第一次,后面每次都显示blob
      

  8.   

    这么说IsNull还是有效过的。那么是否是其他原因引起的。
      

  9.   

    第一次没有向数据库写数据,所以isnull是有效的,但是一旦写过数据就没有办法使其为空了
      

  10.   

    我也不知道了,反正BDE不会出现上述问题。ADO这个东西,唉!
      

  11.   

    我的方法:
    设为空:FieldByName(字段名).Value := null;
    判断:if FieldByName(字段名).IsNull then ... 
    在delphi5 + Access 2000环境中通过,没有问题。至于其他类型数据库是否可行我就不知道了。
      

  12.   

    我的也是access2000,但是用的是adoquery,试过不能成功,请问您用的是bde还是ado
      

  13.   

    弄了那么长时间,都没弄出来,会不会是Delphi的BUG?装过Pack了吗?
      

  14.   

    我用的是ADOQuery,没有问题。
      

  15.   

    对了。我的delphi5打了补丁。不只是否补丁的原因。
      

  16.   

    判断长度嘛。长度为0就表示没有数据select DBMS_LENGH(Blobfield) from table where ...
      

  17.   

    to checky
      我也怀疑是bug,所有想得到的方法都试过了,请问怎样得到pack?
    to fengerfeifei(风儿飞飞) 
      只要一载入字段,根本没有办法清空字段的值,就是说长度永远不可能为0
    to snjun
      试过了:(
      

  18.   

    Borland网站啊,找Pack当然要去那里找了。
      

  19.   

    你应该这样设
    update table set blobfield=EMPTY_BLOB()
    where 。
    这样之后你的blob字段绝对是空的
     
      

  20.   

    to fengerfeifei(风儿飞飞) 
      我用的是access,没有EMPTY_BLOB()有没有办法用sql语句把一个字段置空?
      

  21.   

    试试这个:
    update Table set Field = null where conditions