11 messages in com.mysql.lists.dotnetRE: Decimal point being changed ot de...
FromSent OnAttachments
nil...@aon.at09 Feb 2005 06:48 
Jorge Bastos09 Feb 2005 07:03 
SGr...@unimin.com09 Feb 2005 07:06 
SGr...@unimin.com09 Feb 2005 07:59 
Jorge Bastos10 Feb 2005 15:14 
Guy Platt11 Feb 2005 03:20 
Guy Platt11 Feb 2005 03:46 
Jordan Sparks11 Feb 2005 06:30 
Reggie Burnett23 Feb 2005 06:04 
mike...@mygenerationsoftware.com23 Feb 2005 06:20 
Reggie Burnett23 Feb 2005 07:01 
Subject:RE: Decimal point being changed ot decimal Comma by MySqlComman:Command text
From:Reggie Burnett (reg@mysql.com)
Date:02/23/2005 06:04:07 AM
List:com.mysql.lists.dotnet

You guys should really be using parameters. And if there are problems with parameters that are keeping you from using them, please report them as bugs so they can get fixed.

-reggie

-----Original Message----- From: Jordan Sparks [mailto:jspa@free-dental.com] Sent: Friday, February 11, 2005 8:31 AM To: dot@lists.mysql.com Subject: RE: Decimal point being changed ot decimal Comma by MySqlComman:Command text

You're talking to yourself.

Here's how I send all my dateTime values to MySQL: return myDateT.ToString("yyyy-MM-dd HH:mm:ss",CultureInfo.InvariantCulture);

Otherwise the year gets altered in the Korean culture because they use a different year calendar.

As you can see, it's in a separate function. Every value that goes out to the database gets routed through a similar function. The one for strings handles all the quotes, etc. I don't even think about sending data directly to the database anymore except maybe an int.ToString() which I haven't found any problems with. Same for data coming in from db, although less of an issue.

-----Original Message----- From: Guy Platt [mailto:guy.@nordicadvice.se] Sent: Friday, February 11, 2005 3:47 AM To: Guy Platt Cc: dot@lists.mysql.com Subject: Re: Decimal point being changed ot decimal Comma by MySqlComman:Command text

For those interested, the problem can be fixed by using "CultureInfo.InvariantCulture" to stop the decimal being replaced with a

comma.

So the command to create the CommanText becomes:

myCmd.CommandText = "INSERT INTO ppmr_performance_detail (FundNr, FundShare) VALUES ('" + fundNr +"','" + fundShare.ToString(CultureInfo.InvariantCulture) + " ' )";

regards to all, Guy

Hi,

I'm running 1.0.4 and have encountered something strange.

The following code crashes on the ExecuteQuery with a SQL error.

fundShare = Convert.ToDecimal(( (allocationPerc / 100) * oldSum ) / fundValue)); fundShare = Math.Round(fundShare,2);

myCmd.CommandText = "INSERT INTO performance_detail (FundNr, FundShare) VALUES ('"+ fundNr +"','"+ fundShare +"')"; myCmd.ExecuteNonQuery();

Checking under debug fundShare contains the value "95.66" but the CommandText shows this value as "95,66". I presume that it is a case of .NET storing the decimal with a placeholder or a decimal

point, but

when it is given to the CommandText the value is converted to show a decimal comma (which causes MySql to crash).

Can anyone tell me how to overcome this?

thanks Guy