Cannot use output parameter as currency

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for SQL Server in Delphi and C++Builder
Post Reply
uberbach
Posts: 9
Joined: Tue 22 Sep 2009 10:50

Cannot use output parameter as currency

Post by uberbach » Tue 28 Jan 2014 15:12

There's something strange going on with numeric output parameters of stored procedures, when used as currency in Delphi.

I have the following stored procedure in SQL Server 2008 R2:

Code: Select all

CREATE PROCEDURE Test (
  @DataIn Numeric(12,4),
  @DataOut Numeric(12,4) output
)
as
  set @DataOut = @DataIn
In Delphi 2010 I call this procedure like this:

Code: Select all

  ds := TSQLDataSet.Create(self);
  try
    ds.SQLConnection := ...
    ds.CommandType := ctStoredProc;
    ds.CommandText := 'Test';
    ds.ParamByName('DataIn').AsCurrency := 5.0;
    ds.ExecSQL;
    ShowMessage(ds.ParamByName('DataOut').AsString);
  finally
    ds.Free;
  end;
This works fine, it shows "5".

Then I change @DataIn into an output parameter:

Code: Select all

CREATE PROCEDURE Test (
  @DataIn Numeric(12,4) Output,
  @DataOut Numeric(12,4) output
)
as
  set @DataOut = @DataIn
Then I run the same Delphi program again, but now I get an error:
TDBXTypes.DOUBLE value type cannot be accessed as TDBXTypes.BCD value type
I'm using dbexpsda40.dll version 4.55.0.22 and EnableBCD is set to 'False'.

When I do exactly the same in Delphi 7, using dbexpsda.dll 4.55.0.22, both situations work fine.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Cannot use output parameter as currency

Post by AlexP » Wed 29 Jan 2014 09:11

Hello,

We cannot reproduce the problem on the latest driver version 6.3.4., please update to the latest version and try to reproduce the problem on it. If the problem repeats, please contact us again.

Post Reply