Subject | RE: [firebird-support] decimal separator |
---|---|
Author | Sasha Matijasic |
Post date | 2008-08-25T22:18:37Z |
> Hi !Try this:
> I generate some inserts with my Delphi app. I'm experimenting some
> problems if
> the PC which is running the program has , (comma) as decimal separator.
>
> Having a field "amount" numeric (18,3) an a value of $100.23
> My insert would be like:
>
> INSERT INTO MYTABLE (amount) VALUES 100,23
>
Insert into mytable (ammount) values (100.23);
You need to use a dot, not a comma. And you need parens.
> I'd like to know is the common practice to deal with it. I couldThe correct way is to use parameters like this (pseudo delphi code)
> reeplace the
> "," for a "." in my app. But is that the *correct* way to do it?
>
ammount := 100.23;
dataset.sql := 'insert into mytable (ammount) values (:ammoutn)';
dataset.parambyname('ammount').asfloat := ammount;
dataset.execquery;
exact syntax depends on your components, but this should give you an idea to go on.
Sasha