EConvertError on Post

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
tolson68
Posts: 5
Joined: Fri 04 May 2007 20:08

EConvertError on Post

Post by tolson68 » Sat 05 May 2007 06:14

Hello,

I have a MSTable that is referencing a table with a decimal(30,15) column. The field is being seen as a TFMTBCDField (which is what I want). When I try to edit the value in the decimal field I get a EConvertError when Post is called. Here is the code that is changing the value:

var
bcd: TBcd;
s: string;
begin
with MSTable1 do begin
First;
s := FieldByName('exchange_rate').AsString;
s := '1' + s;
bcd := StrToBcd(s);
Edit;
if FieldByName('exchange_rate') is TFMTBCDField then
TFMTBCDField(FieldByName('exchange_rate')).AsString := s
else
FieldByName('exchange_rate').AsString := s;
Post; // This is where the EConvertError is generated
end;

Please note that this is only a test and the above logic is just to validate the functionality of the components. I have also tried:

...
TFMTBCDField(FieldByName('exchange_rate')).Value := bcd
...

The value that I was testing is 0.72222 and the value I am updating it to is 10.72222 (Well within the limits of a BCD and decimal(30,15).

Any suggestions will be greatly appreciated.

Tom

tolson68
Posts: 5
Joined: Fri 04 May 2007 20:08

Post by tolson68 » Mon 07 May 2007 06:16

I made a change the the SDAC demo application so the NumericType is set to FMTBCD and I can reproduce the error. I am using D7 Pro.

Please Help! This is a show stopper for us.

Jackson
Posts: 512
Joined: Thu 26 Jan 2006 10:06

Post by Jackson » Mon 07 May 2007 08:52

We couldn't reproduce the problem.
Please send us (evgeniym*crlab*com) a complete small test project to reproduce the problem;
include definition of your own database objects; don't use third party components.

Also supply us the following information:
- Exact version of Delphi or C++ Builder.
- Exact version of SDAC. You can see it in the About sheet of TMSConnection Editor.
- Exact version of Microsoft SQL Server and OLE DB provider you use. You can see it the Info sheet of TMSConnection Editor.

tolson68
Posts: 5
Joined: Fri 04 May 2007 20:08

Post by tolson68 » Mon 07 May 2007 17:38

Jackson,

I sent you the information you requested. Please let me know if you have any other questions.

Tom

Post Reply