Currency problem

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
toxedo
Posts: 6
Joined: Mon 18 Feb 2008 13:58

Currency problem

Post by toxedo » Tue 22 Apr 2008 14:40

I'm presently changing the communication between my application (Delphi7) and SQL SERVER 2005 SP2. I'll use SDAC 4.35.1.16. In the past the Stored Procedure returns money fields without currency. Now with sdac the currency is include in the dataset and is incompatible with all the reports who are suppose to received a BCD value.

I've read the past topics about that subject and I realize that there is no parameter settings that could be use to exclude the currency from the fields.

Is that still true?

Someone is talking about modifing OLE DB to do that. How can we do that?

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Wed 23 Apr 2008 14:45

There is an option. You should set the currency property of the TCurrencyField to False. For example:

Code: Select all

  MSQuery1.Open;
  (MSQuery1.FieldByName('c_money') as TCurrencyField).currency := False;

toxedo
Posts: 6
Joined: Mon 18 Feb 2008 13:58

NOt an issue for me.

Post by toxedo » Wed 30 Apr 2008 08:32

Thanks Antaeus. But all my requests are made via stored procedure call. The solution you gave me does not work for this type of request.

Any other issue?

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Wed 30 Apr 2008 09:29

The same works for stored procedures returning result sets:

Code: Select all

  MSStoredProc1.Open;
  (MSStoredProc1.FieldByName('c_money') as TCurrencyField).currency := False;
If you get data from the server in another way, describe it here in more details or send me a small test sample to sdac*crlab*com.

toxedo
Posts: 6
Joined: Mon 18 Feb 2008 13:58

It works now.

Post by toxedo » Wed 30 Apr 2008 13:03

Thanks a lot Antaeus. It will need a lot of coding but it will do the job!

toxedo
Posts: 6
Joined: Mon 18 Feb 2008 13:58

where to find in the documentation or Help manual.

Post by toxedo » Wed 30 Apr 2008 13:17

Could you tell me where I can find that property (.currency) in the documentation or in the help manual?

toxedo
Posts: 6
Joined: Mon 18 Feb 2008 13:58

Problem with the variable type

Post by toxedo » Wed 30 Apr 2008 19:51

Obviously, I have another problem with the variable type when the dataset is transfered to Rave Report. The RAVE application is supposed to receive a BCD type variable and it receives a Currency one.

Is there any technique I could use to convert de datatype of one field of the dataset?

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Mon 05 May 2008 07:02

I can suggest you the following ways:
1) set the EnableBCD option of your datasets to True and convert your queries so that they return the NUMERIC data type instead of MONEY. For example:

Code: Select all

    SELECT CAST(c_money as NUMERIC(15,2)) c_money FROM tb_money
2) perform such converting locally using calculated fields;
3) if you have sources of SDAC, you can change data types mapping in sources. Contact us by e-mail (sdac*crlab*com) to obtain the detailed instructions.

Post Reply