Error : Field xxx must have a value

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
arch-vile
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 18.01.2007, 04:33
Location: Jakarta
Contact:

Error : Field xxx must have a value

Post by arch-vile »

Halo,

I use Delphi 7 with Zeos 6.6.0-beta, before used Zeos 6.6.0-beta I used an old version Zeos 6.1.5-stable.

I have problem in Delphi with new Zeos component. Before upgrade to 6.6.0-beta the code work fine. Error occured when checking the value of that field. If the value of that field is NULL or when the IF condition below is FALSE.

Below is quoted of my code.

------begin--------
if not zquery1.FieldByName('disc_cash').IsNull then
zquery2.FieldByName('disc_cash').AsCurrency := zquery1.FieldValues['disc_cash'];
------end----------

The error message appear :
... exception class EDatabaseError with message 'Field 'disc_cash' must have a value'.

Anyone can help me how to fix it??

thank u..
.arifin

i used mysql 4.1
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

I suppose disc_cash in zquery2 is defined as 'not null default 0' (or something similar putting a default on it). Try to set the required property of the field to false before inserting.

Mark
arch-vile
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 18.01.2007, 04:33
Location: Jakarta
Contact:

Post by arch-vile »

Hello Mark,

Yes, the problem on zQuery2, default for field required property is set to true. On old version of zeos, default field required property is set to false.

Thank u Mark.
arifin
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Hi arifin,

The reason is now we check the table definitions on the database. Maybe we should also check if a database default value is provided.

I hope somebody can write a small patch to check this. (If it's not already on the forum yet)

Mark
Post Reply