Jump to content

Error IsNull function in UniDbGrid


Recommended Posts

Hi,

 

I have an error detected using UniDbGrid (TUniDbGrid) related to an Interbase table.

Also I am using Delphi 10.2 Tokyo with Unigui version 10.0.1472.

In a column where Integer type values ​​are loaded (the same happens with Float type fields), if I insert the value 0 (zero) when validating the previous record of its insertion in the table, the IsNull function returns the value True.

 

The exact validation done in the BeforePost event of the table is as follows:

 

If TableName.FieldByName ('AmountFrom'). IsNull then

  ShowMessage ("You must enter an amount greater than or equal to 0")

 

The problem is that if I charge amount = 0 the, when doing the previous validation I get the message that I must enter an amount because of the IsNull function returns TRUE. If 0.01 is reported (or any value other than 0) the IsNull function returns FALSE.

 

I did the same test using DbGrid (TDbGrid) and the "IsNull" function worked correctly returning TRUE if nothing was actually entered in the column and FALSE if 0 (zero) was loaded so the problem is not at the database level.

 

In this case I am not using querys but I use the TIBCTable and TIBCDataSource components of Devart.

 

Thanks in advance

Link to post
Share on other sites
Thanks for the reply.

It is a possibility but I have similar validations in several tables and it would imply changing them all and in this case it would not be the best solution.

 

Thanks

Link to post
Share on other sites

 

It is a possibility but I have similar validations in several tables and it would imply changing them all and in this case it would not be the best solution.

 

That is what batch SQL is for :) If 3 minutes of copy & paste can save me 3 days of trouble, I am all in.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...