Not VarIsNull or <> Null lazarus / 16-Databases ---------------------------------------------------------------------- luca · 2013-07-26 06:46 Hi. I found e really strange bug. If I test a query field value using VarIsNull (like if not VarIsNull(Qry1['Field1'])) sometimes I receive EVariantInvalidOpError. If I use Qry1['Field1']<>null all it's fine. So what's best way to check if a query returns null in a field? Thanks for you great job! ---------------------------------------------------------------------- taazz · 2013-07-26 07:01 Code: [Select]Qry.FieldByName('field1').IsNull that is the recommended way. ---------------------------------------------------------------------- BigChimp · 2013-07-26 07:28 Quote from: luca on July 26, 2013, 08:46:37 amI found e really strange bug. If I test a query field value using VarIsNull (like if not VarIsNull(Qry1['Field1'])) sometimes I receive EVariantInvalidOpError. If I use Qry1['Field1']<>null all it's fine. If you have a small FPC demo program that demonstrates this problem, maybe it has clues for any underlying problems with variant handling in FPC. Of course, that depends on the FPC version you're using - please specify FPC+Lazarus+operating system - you can put it in your forum signature (see the profile page).