| View previous topic :: View next topic |
| Author |
Message |
moritenw Guest
|
Posted: Fri Sep 19, 2003 2:00 am Post subject: work with TBCDField |
|
|
I have a project used with TADODataset, the dataset bind a MSSQL table
include numeric(28, 5) Field(A).When i get the field on design state, the
type of field(A) returned is TBCDField with property precision = 28 and size
= 5.But the Value of Field(A) will be trunct to 4 fraction(0.2222) when i
input 5 fraction number(0.22222). what is the matter? Working environment is
delphi6 + mssql.please somebody tell me and help me?
|
|
| Back to top |
|
 |
Ignacio Vazquez Guest
|
Posted: Fri Sep 19, 2003 4:08 am Post subject: Re: work with TBCDField |
|
|
"moritenw" <moritenw (AT) 163 (DOT) net> wrote
| Quote: | please somebody tell me and help me?
|
Sounds like you're using .AsCurrency to manipulate the field. Currency is
restricted to 4 decimal places so you should look at .AsFloat instead.
Cheers,
Ignacio
|
|
| Back to top |
|
 |
moritenw Guest
|
Posted: Fri Sep 19, 2003 6:11 am Post subject: Re: work with TBCDField |
|
|
That was not as you thouht. the value of property currency of Field(A) is
false.
I do input the value in a TDBGrid. The value was trunct after input the
value and leave the cell.
"Ignacio Vazquez" <ivazquezATorioncommunications.com> дÈëÓʼþ
news:3f6a8158 (AT) newsgroups (DOT) borland.com...
| Quote: | "moritenw" <moritenw (AT) 163 (DOT) net> wrote in message
news:3f6a63a1 (AT) newsgroups (DOT) borland.com...
please somebody tell me and help me?
Sounds like you're using .AsCurrency to manipulate the field. Currency is
restricted to 4 decimal places so you should look at .AsFloat instead.
Cheers,
Ignacio
|
|
|
| Back to top |
|
 |
John Herbster (TeamB) Guest
|
Posted: Thu Oct 16, 2003 2:19 pm Post subject: Re: work with TBCDField |
|
|
"moritenw" <moritenw (AT) 163 (DOT) net> wrote
| Quote: | I have a project used with TADODataset, the dataset bind
a MSSQL table include numeric(28, 5) Field(A).When i get
the field on design state, the type of field(A) returned is
TBCDField with property precision = 28 and size >= 5.
But the Value of Field(A) will be trunct to 4 fraction(0.2222)
when i input 5 fraction number(0.22222). what is the matter? ...
|
I notice in D7's Help:
"The IDE uses two different field types for representing BCD fields:
TBCDField and TFMTBCDField. TBCDField uses the Currency (Delphi) or
System::Currency (C++) type to manipulate BCD values. This is faster
than storing and manipulating the value using a true BCD type, but
limits the precision of the BCD values it can support to 4 decimal
places and 20 significant digits."
Thus it would appear that your dataset should be using the
field type TFMTBCDField. Can you change it?
Regards, JohnH
|
|
| Back to top |
|
 |
moritenw Guest
|
Posted: Fri Dec 12, 2003 1:53 am Post subject: Re: work with TBCDField |
|
|
thks for your respond. I had found the how to resovle it. just set the
property of TADODataSet EnableBCD to False, the it will generate the
TfloatField type rather than TBCDField type.
"John Herbster (TeamB)" <herb-sci1 (AT) sbcglobal (DOT) net> ????
news:3f8ea799$1 (AT) newsgroups (DOT) borland.com...
| Quote: |
"moritenw" <moritenw (AT) 163 (DOT) net> wrote
I have a project used with TADODataset, the dataset bind
a MSSQL table include numeric(28, 5) Field(A).When i get
the field on design state, the type of field(A) returned is
TBCDField with property precision = 28 and size >= 5.
But the Value of Field(A) will be trunct to 4 fraction(0.2222)
when i input 5 fraction number(0.22222). what is the matter? ...
I notice in D7's Help:
"The IDE uses two different field types for representing BCD fields:
TBCDField and TFMTBCDField. TBCDField uses the Currency (Delphi) or
System::Currency (C++) type to manipulate BCD values. This is faster
than storing and manipulating the value using a true BCD type, but
limits the precision of the BCD values it can support to 4 decimal
places and 20 significant digits."
Thus it would appear that your dataset should be using the
field type TFMTBCDField. Can you change it?
Regards, JohnH
|
|
|
| Back to top |
|
 |
|