Board index » delphi » Please Help, ADO Currency to Currency Problem

Please Help, ADO Currency to Currency Problem

Hello,

I am using Ado via Variants. Everything is working well except for
when the ado field type is adCurrency. I don't know how to convert
this to a Currency variable. If any one could help, I'd really appreciate
it.

 

Re:Please Help, ADO Currency to Currency Problem


Quote
> I am using Ado via Variants. Everything is working well except for
> when the ado field type is adCurrency. I don't know how to convert
> this to a Currency variable.

Var V: OleVariant;
...
  V := RecordSet.Fields['SomeName'].Value;
  If TVarData(V).VType=14 Then
    //14 is the MS's Decimal variant type which is unsupported by Delphi
    //and we therefore have to convert it to varDouble. varCurrency could
    //also be used but it has a very limited precision.
    V := VarAsType(V, varDouble);

HTH
--
Vassil Nazarov
http://web.orbitel.bg/vassil/

Other Threads