Subject | Parameter Values Problem (decimalseparator changed) |
---|---|
Author | Calin Iancu Pirtea |
Post date | 2003-06-29T11:02:43Z |
How to show the problem:
-create a query with a currency parameter
-set the paramater at design time to some value
-at runtime change the decimalseparator
-prepare the query
Example:
Parameter at design time='0.000' note the decimal separator='.'
At runtime decimalseparator=','
On prepare the query will try to set the design time parameters
but StrToCurr will fail because '0.000' is not valid due to the new
decimalseparator ','.
Solutions:
1)Don't use design params where decimalseparator will change
2)Use OldParamValueLinks.Clear before prepare
3)Modify SysRestoreParamValueLinks to change the decimalseparator
in existent old parameters.
It would be nice to have 3 integrated into IBO.
It is very simple:
IBA_Statement.imp
in SysRestoreParamValueLinks add the next lines before AsString := tmpStr
<snip>
with Params[ii] do
if not IsBlob and not IsArray then
<snip>
if IsCurrencyDataType then //Added line
tmpStr[Length(tmpStr)+SQLScale]:=DecimalSeparator;//Added line
AsString := tmpStr;
Probably it could be used depending on SQLScale<>0 instead of
IsCurrencyDataType
but I'm not sure about that.
Ciao,
Best regards,
Application Developer
Calin Iancu, Pirtea
S.C. SoftScape S.R.L.
pcalin@...
-create a query with a currency parameter
-set the paramater at design time to some value
-at runtime change the decimalseparator
-prepare the query
Example:
Parameter at design time='0.000' note the decimal separator='.'
At runtime decimalseparator=','
On prepare the query will try to set the design time parameters
but StrToCurr will fail because '0.000' is not valid due to the new
decimalseparator ','.
Solutions:
1)Don't use design params where decimalseparator will change
2)Use OldParamValueLinks.Clear before prepare
3)Modify SysRestoreParamValueLinks to change the decimalseparator
in existent old parameters.
It would be nice to have 3 integrated into IBO.
It is very simple:
IBA_Statement.imp
in SysRestoreParamValueLinks add the next lines before AsString := tmpStr
<snip>
with Params[ii] do
if not IsBlob and not IsArray then
<snip>
if IsCurrencyDataType then //Added line
tmpStr[Length(tmpStr)+SQLScale]:=DecimalSeparator;//Added line
AsString := tmpStr;
Probably it could be used depending on SQLScale<>0 instead of
IsCurrencyDataType
but I'm not sure about that.
Ciao,
Best regards,
Application Developer
Calin Iancu, Pirtea
S.C. SoftScape S.R.L.
pcalin@...