MS SQL currency type shown as float in schema builder

image

ah yes, it for queries only.

try NumericType=ntBCD instead

https://www.devart.com/sdac/docs/devart.sdac.tcustommsconnectionoptions.numerictype.htm

hmm, is this AV reproduced in runtime?

no no, i’m trying the solution in the schema builder
but for some reason the connection is also flagged as
image

try launch your server under debugging. it should give call-stack for this error

it’s the schema builder that throws this error, don’t think the runtime will be affected

restarting the IDE solves the connection issue…

I’ll log issue that allows to set such parameters via Options.xxx=yyy

Thanks, logged as bugs://83006

the answer i got from sdac
Hello,

By default, SDAC creates TCurrencyField in Delphi for “currency” type fields from a database.
You can verify this by running the SQL statement without using Remobjects DataAbstract, e.g.:

CREATE TABLE [dbo].[ALL_TYPES](
[uid] [int] IDENTITY(1,1) NOT NULL,
[c_money] [money] NULL,
[c_smallmoney] [smallmoney] NULL
)

procedure TForm1.buOpenClick(Sender: TObject); begin
MSConnection1.Connect;
MSQuery1.SQL.Text := ‘SELECT * FROM ALL_TYPES’;
MSQuery1.Open;

Memo1.Lines.Add(MSQuery1.FieldByName(‘c_money’).FieldName + ': ’ + MSQuery1.FieldByName(‘c_money’).ClassName);
end;

Remobjects DataAbstract might set the field type to float for numeric fields on a client by default.
Try to explicitly set the data type if possible.

bugs://83006 got closed with status fixed.

the issue in another:
SDAC treats money as TCurrencyField that actually is TFloatField:

  TCurrencyField = class(TFloatField)
  public
    constructor Create(AOwner: TComponent); override;
  published
    { Lowercase to avoid name clash with C++ Currency type }
    property currency default True;
  end;

and value is stored as double

DA uses TBCDField for money type that is more suitable for currency type.


I’ve added a new option to SDAC driver - UseBCDforMoneyTypes that adds correspondent mapping to SDAC driver.

uDASDACDriver.pas (15.4 KB)

usage:

  • compile ..\Data Abstract for Delphi\Source\Drivers\DASDACDrv.dpr with any unicode version of Delphi
  • replace ..\Data Abstract (Common)\Bin\DASDACDrv.dad with compiled file
  • add UseBCDforMoneyTypes=1 to connection string

after this, money types will be detected correctly in SDAC driver

I’d say make this the default?

hi Evgeny,

is this included in the 10.x release which just got out? (i saw that the 82997 is already included so…)

hi,
no, it isn’t.
release was created two days ago, but this fix (bugs://83006) was fixed yesterday …

ok no problem

use this instruction

good idea, will

1 Like