Recent

Author Topic: SQL shouting that the conversion error, "1,23" - should be 1.23  (Read 5663 times)

abmservice

  • Jr. Member
  • **
  • Posts: 69
I have a loop that inserts the data into my script.
Name: currency;
.......
for x=1 to 100 do
....
name: = 1.23;
INSERT INTO test VALUE ('''+ id_schemat +''','''+ name +''')
SQL shouting that the conversion error, "1,23" - should be 1.23
how do I do this?

eny

  • Hero Member
  • *****
  • Posts: 1634
Re: SQL shouting that the conversion error, "1,23" - should be 1.23
« Reply #1 on: April 12, 2010, 09:08:30 pm »
Different regional settings between the lazarus app and the MySQL server.

All posts based on: Win10 (Win64); Lazarus 2.0.10 'stable' (x64) unless specified otherwise...

abmservice

  • Jr. Member
  • **
  • Posts: 69
Re: SQL shouting that the conversion error, "1,23" - should be 1.23
« Reply #2 on: April 12, 2010, 09:49:11 pm »
How does it solve? do not want to change the locale in the program would prefer to resolve

clauslack

  • Sr. Member
  • ****
  • Posts: 275
Re: SQL shouting that the conversion error, "1,23" - should be 1.23
« Reply #3 on: April 12, 2010, 09:52:51 pm »
If you pass the values of SQL in string, you must use 1.23.

You have 2 options
1) Changes regional settings,
decimal separator= "."
Thousand Separator=","

2) Pass Sql values with ParamByName.

Regards

abmservice

  • Jr. Member
  • **
  • Posts: 69
Re: SQL shouting that the conversion error, "1,23" - should be 1.23
« Reply #4 on: April 13, 2010, 07:35:07 am »
Pass Sql values with ParamByName.
in a loop that does not work:(
and maybe there is a feature which will turn "," to "." in string

eny

  • Hero Member
  • *****
  • Posts: 1634
Re: SQL shouting that the conversion error, "1,23" - should be 1.23
« Reply #5 on: April 13, 2010, 03:29:13 pm »
It's more or less the same issue as in your previous post.
Doesn't that work?
All posts based on: Win10 (Win64); Lazarus 2.0.10 'stable' (x64) unless specified otherwise...

abmservice

  • Jr. Member
  • **
  • Posts: 69
Re: SQL shouting that the conversion error, "1,23" - should be 1.23
« Reply #6 on: April 13, 2010, 07:45:48 pm »
stringreplace(string,',','.',[]) it's work:)

 

TinyPortal © 2005-2018