How to differ between null and '' ?

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
kaffeburk
Posts: 214
Joined: Mon 29 Jan 2007 08:03

How to differ between null and '' ?

Post by kaffeburk » Sat 13 Sep 2008 13:12

I have a varchar field that sometimes is null and sometimes is just empty ('').

How can i check witch one it is? I would like to use a FieldByName to get the field.

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Mon 15 Sep 2008 09:36

To indicate whether the field is null you should use the TField.IsNull property.
To indicate whether the field is empty you should check if TField.AsString = ''.

Post Reply