a if statement not detecting a time field comparison to NULL

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Guest

a if statement not detecting a time field comparison to NULL

Post by Guest » Thu 18 May 2006 12:49

Hello,

I have this piece of code. Whenever the FieldValues["Upgrade_Time_Start"] does equal NULL it goes to the else section of the if statement instead of running JvMaskEdit_Upgrade_Start_Time->Clear(); piece of code. The field Upgrade_Time_Start is a time variable.



if(MyQuery_Upgrade_Training->FieldValues["Upgrade_Time_Start"] == NULL)
JvMaskEdit_Upgrade_Start_Time->Clear();
else
JvMaskEdit_Upgrade_Start_Time->Text=MyQuery_Upgrade_Training->FieldValues["Upgrade_Time_Start"];



Any suggestions on whats wrong?


Thanks!

---Dave

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Thu 18 May 2006 15:32

Try using

Code: Select all

if(MyQuery_Upgrade_Training->FieldValues["Upgrade_Time_Start"]->IsNull()) 
instead of

Code: Select all

if(MyQuery_Upgrade_Training->FieldValues["Upgrade_Time_Start"] == NULL) 

Post Reply