Board index » delphi » The database data type is numeric(18,6),but the field created by tadodataset is TBCDFIELD,so its scale only up to 4.

The database data type is numeric(18,6),but the field created by tadodataset is TBCDFIELD,so its scale only up to 4.

How can i do?
Thanks
billistar
 

Re:The database data type is numeric(18,6),but the field created by tadodataset is TBCDFIELD,so its scale only up to 4.


"li qunxin" <billis...@sina.com> wrote

Quote
> The database data type is numeric(18,6),but the field created by

tadodataset is TBCDFIELD,

Quote
> so its scale only up to 4.

Billistar,
  Eigh{*word*249} digits can be exactly represented by currency and almost
exactly by extended data types, but not by type double.
  What does the number represent?  How would the value be used,
if you could write it and read it in the data file?
  There is the AsBCD property of the TField, but it appears not
to be fully implemented.
Can you use
  AsCurrency := <your extended value>*100;
  <your extended var> := AsCurrency/100;
Somebody else may know more.
Regards, JohnH

Re:The database data type is numeric(18,6),but the field created by tadodataset is TBCDFIELD,so its scale only up to 4.


The database i used is MS sqlserver.The data type is
numeric(18,6),represents the weight of some goods.
I have found a way,but it's fussy.
Create a new field from the Fields editor,and set  type of the field to
float,then it works.

Re:The database data type is numeric(18,6),but the field created by tadodataset is TBCDFIELD,so its scale only up to 4.


"li qunxin" <billis...@sina.com> wrote

Quote
> ... The data type is numeric(18,6),represents the weight
> of some goods.

Li,  Have you stopped to think that with a 18 digit field you
can represent the weight of a 250,000 ton ship to 1 microgram.
It seems proposterous to use an 18 digit field for that.
Rgds, JohnH

Re:The database data type is numeric(18,6),but the field created by tadodataset is TBCDFIELD,so its scale only up to 4.


Re:The database data type is numeric(18,6),but the field created by tadodataset is TBCDFIELD,so its scale only up to 4.


"li qunxin" <billis...@sina.com> wrote

Quote
> ... The data type is numeric(18,6),represents the weight
> of some goods.

Have you stopped to think that with a 18 digit field you
can represent the weight of a 250,000 ton ship to 1 microgram.
It seems preposterous to use an 18 digit field for that.

"li qunxin" <billis...@sina.com> wrote
[As a general software,it must be extensible]

Then I suggest that a decimal(18,6) field is *not* suitable.
(Decimal(18,6) field cannot handle nanograms.)  Instead,
you should use a floating point field or a much smaller fixed
decimal point or integer field or even string field plus a
helper field to specify the units of measure (tones,
nanograms, pounds, etc.)  Do *not* use fields that push
the technology when it when they are of no benefit.
Regards, JohnH

Other Threads