BCD Overflow after updating from 3 to 4

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for SQL Server in Delphi and C++Builder
Post Reply
wdwhitaker
Posts: 8
Joined: Sun 08 Oct 2006 13:55

BCD Overflow after updating from 3 to 4

Post by wdwhitaker » Mon 10 Nov 2008 18:57

Delphi 7.0
4.45.0.12
SQL Server 2005

I have just updated to 4 from 3 and simply installed over previous version and now when running application (without recompile), I am trying to post data using stored procedure, and getting BCD overflow error. Works fine in 3.

EnableBCD is unchanged from default.

Procedure called is following:

spInsertRates.parambyname('currid').asinteger := DeltaValueNum(DeltaDS,'CurrencyID');
spInsertRates.parambyname('currrate').asfloat := DeltaValueNum(DeltaDS,'CRate');
spInsertRates.parambyname('currdate').asSQLTimeStamp := DateTimeToSQLTimeStamp(DeltaValue(DeltaDS,'CDate'));
spInsertRates.parambyname('user').asstring := g_user;
spInsertRates.execproc;

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Tue 11 Nov 2008 14:20

Please try to set the EnableBCD option to False. Does it solve the problem?

wdwhitaker
Posts: 8
Joined: Sun 08 Oct 2006 13:55

Post by wdwhitaker » Tue 11 Nov 2008 18:55

Dimon wrote:Please try to set the EnableBCD option to False. Does it solve the problem?
I set enableBCD = False and recompiled the program with the newer version. It seemed to work, but how does that effect my program where certain fields are formatted as BCD or FmtBCD?

wdwhitaker
Posts: 8
Joined: Sun 08 Oct 2006 13:55

Post by wdwhitaker » Tue 11 Nov 2008 22:22

wdwhitaker wrote:
Dimon wrote:Please try to set the EnableBCD option to False. Does it solve the problem?
I set enableBCD = False and recompiled the program with the newer version. It seemed to work, but how does that effect my program where certain fields are formatted as BCD or FmtBCD?

I take that back. It did not solve the problem. Still getting BCD Overflow. What do I need to look at to solve this problem?

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Wed 12 Nov 2008 13:00

I could not reproduce the problem.
Please send me a complete small sample at dmitryg*devart*com to demonstrate it, including script to create and fill table.

sparkz
Posts: 9
Joined: Thu 15 May 2008 17:01

Post by sparkz » Fri 23 Jan 2009 16:32

I'm getting this problem as well (same version of SQL and Delphi). On version 3 it was fine. Loaded the new driver (4.45.0.14) and I get the problem with BCD overflow.

I set the EnabledBCD option to False and recompiled and it didn't make any difference.

I get the error when calling a procedure via TSQLStoredProc which has several parameters of type MONEY. It never arrives at the procedure code.

It's easy to reproduce. You just need a empty procedure with a single MONEY parameter.

Loading the parameters like so:

Proc1.Params.CreateParam(ftCurrency, 'Value', ptInput);
...
Proc1.ParamByName('Value').AsCurrency := 100.0;

Execute it (ExecProc) and you get the error.

Thanks

Edit: I've emailed you a very small example which recreates the problem for me. It doesn't involve tables just an empty procedure with one MONEY parameter and a few lines of code to call it.

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Tue 27 Jan 2009 09:55

The problem is that the EnabledBCD option is an extended option of DbxSda. Delphi 7 has restriction of dbExpress for setting such options. In order to overcome restrictions of dbExpress, DbxSda provides the TCRSQLConnection component. Extended options are available with TSQLConnection only at run time. To convert quickly from TSQLConnection to TCRSQLConnection you can use the "Convert to TCRSQLConnection" item of component's pop-up menu.

If you need to use TSQLConnection, then you should use the following code at run time:

Code: Select all

const
  coEnableBCD = TSQLConnectionOption(102);
. . .
  SQLConnection1.SQLConnection.SetOption(coEnableBCD, Integer(False));
You can find more detailed information about it in Readme.html.

Post Reply