Board index » delphi » How to write to BCD field type?

How to write to BCD field type?


2004-06-05 12:09:46 AM
delphi278
Hello,
I use CreateTable method to create a table, in which I have several fields
whose types are set as ftBCD. I use this type because I want to set the
precision and size of the fields. However, I could not write values from
variables of double type to the fields. Many thanks for any instruction.
Goncalo
 
 

Re:How to write to BCD field type?

I am using Delphi 7, BDE ver. 5.1. I put a TTable on my form, named
tblMetabolites. I wrote as follows:
with tblMetabolites do
begin
Active:= false;
TableType:= ttDBase;
TableName := 'Metabolites';
{Next, describe the fields in the table }
with FieldDefs do
begin
Clear;
with AddFieldDef do begin
Name := 'AA_pool';
DataType := ftBCD;
size:= 12;
precision:= 4;
end;
...
createtable;
active:=true
end; //with tblMetabolites
I could not do as follows:
Var AA_pool: Double;
with dataMod.tblMetabolites do
begin
Append;
fieldbyname('AA_pool').value := AA_pool;
...
post;
end;
Delphi generated and exception when assigning AA_pool to the field in the
table.
Thank you in advance for your answear.
Regards,
An
"Bill Todd (TeamB)" <XXXX@XXXXX.COM>writes
Quote
It is very difficult to answer database questions when you do not tell
us what database and version you are using.

--
Bill (TeamB)
(TeamB cannot respond to questions received via email)