我从数据库选出数据后,如果数据是NUll,我就不能把它付给文本框,请问怎么写这段代码啊?

解决方案 »

  1.   

    if not (Query1.FieldByName('Field1').isnull) then
        Edit1.Text := Query1.FieldByName('field1').asString;
      

  2.   

    利用字段对象的IsNull属性,如下:if Not Query1.FieldByName('FieldName').IsNull then
      Edit1.Text := Query1.FieldByName('FieldName').AsString;
      

  3.   

    if Not Query1.FieldByName('FieldName').IsNull or Not Query1.FieldByName('FieldName').Asstring=''  then
      Edit1.Text := Query1.FieldByName('FieldName').AsString;