• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 913
  • Last Modified:

using bde for database field with 6 decimal

hi,
l'm using delphi 7 with bde. l'm having problem with database table which field have 6 decimal points.i used TQuery to retrieve the data and present to dbgrid. but its only show up to 4 decimal.
as i knew, bde will create BCD field for this but BCD can only support up to 4 decimal.the only fieldtype that can support up to 6 decimal is ftFMTBCD. i've tried to change the datatype to ftFMTBCD of fieldefs at runtime and re-create the field. when i opened the Tquery, it raised error
'expecting ftFMTBCD, actual ftBCD'. i cannot change bde to use others like dbexpress. any solution for this problem ? please....i really need solution to complete my application. any help would be appreciated.

thank you.

regards
eddie
0
Explorer060599
Asked:
Explorer060599
  • 6
  • 3
  • 3
1 Solution
 
Ferruccio AccalaiSenior developer, analyst and customer assistance Commented:
What is the database? Pdox? IB?....
0
 
kretzschmarCommented:
i hate bcd ....
what database?
listening . . .

0
 
Explorer060599Author Commented:
oracle and mssql. i need to support both.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
kretzschmarCommented:
usual i tested it on oracle,
since there is no decimal-type,
you have to define the field as
NUMBER(9,6) for example

such fields are treated as TFloatfield,
and there are no display issues

meikl ;-)
0
 
Explorer060599Author Commented:
because i've enabled the BCD in BDE. but i cannot disable it for somereason. anyway out ?
0
 
kretzschmarCommented:
on oracle this setting has no effect

such fields are also treated as TFloatfield then

meikl ;-)
0
 
Explorer060599Author Commented:
i get TFloatfield when i disable the "Enable BCD" in bde. when it get enabled, it create field as TBCDField.
0
 
Ferruccio AccalaiSenior developer, analyst and customer assistance Commented:
so use a tdatabase....
create an Alias In TDatabase linked to the oracle one, then double click on the Tdatabase and load the Defaults in the Wizard, then change the EnableBCD value there to FALSE...finally add your TDAtasets linked to the TDatabase Alias...
try this and tell us about it....
0
 
Explorer060599Author Commented:
as i mentioned, i cannot disable the "Enable BCD" since i need tbcdfield as well for others decimal field on preventing rounding error. but i also need to handle field more than 4 decimal.
0
 
Explorer060599Author Commented:
l've found a workaround that uses TField.GetData and SetData. just hook on the TField.OnGetData and onsetdata, manually convert text to bcd and from.  the exmple can download from below's link
http://codecentral.borland.com/codecentral/ccweb.exe/listing?id=13959

can i cancel this question now ?

btw, thank you for helps very very much.

regards
eddie
0
 
Ferruccio AccalaiSenior developer, analyst and customer assistance Commented:
For me it's OK to PAQ and Refund....

F68 ;-)
0
 
Explorer060599Author Commented:
i dont know if its fair to your,bcox i found the solution myself. please tell me if i need to give point.
i dont mind to give point, the things i care abt is your helps. really really appreciate.

thank you.

regards
eddie
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 6
  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now