[Mono-list] Converting float to string for a MySQL db and internationalisation

Sergio Blanco Cuaresma sergio-blanco@iespana.es
Sat, 27 Dec 2003 16:29:15 +0100


--=-35IEgf0SUn5GcuxCy0Q6
Content-Type: text/plain; charset=iso-8859-15
Content-Transfer-Encoding: quoted-printable

El s=E1b, 27-12-2003 a las 08:59, yoros@wanadoo.es escribi=F3:
> On Fri, Dec 26, 2003 at 08:48:48PM +0100, Sergio Blanco Cuaresma wrote:
> >=20
> > I have a little problem and I don't know how to solve it in an elegant
> > way, due to internationalisation (my locales are "es_ES@euro") when I
> > convert from a float type to string the decimal separator is ",", thats
> > fantastic but I'm trying to insert that value in a MySQL database, and
> > it seems to need "." as decimal separator:
> >=20
> > string sql =3D "INSERT INTO indexed VALUES ('" +
> > (fileInfo.Length).ToString("#.##") + "');";
> >=20
> > How would you solve this little problem? Is there any more elegant way
> > of inserting data in a MySQL database? I'm using ByteFX.Data.
> >=20
>=20
> You can change DecimalSeparator to ".":
>=20
> 	using System.Globalization;
> 	...
> 	NumberFormatInfo.CurrentInfo.NumberDecimalSeparator =3D ".";

It seems to be read only:

Excepcion: The current instance is read-only and a set operation was
attempted


--=20

[aka Marble]
 Web Personal  <>  http://www.marblestation.com
 Registered LiNUX user #140941  <>  http://counter.li.org/
 Socio #3274 de HispaLinux  <>  http://www.hispalinux.es
 Miembro de GPL URV  <>  http://www.gplurv.org
 GnuPG key: 0x0ED2CF9D  <>  hkp://pgp.escomposlinux.org

--=-35IEgf0SUn5GcuxCy0Q6
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada
	digitalmente

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQA/7aVKfGXf5g7Sz50RAgFKAJ9FfPYOT26VZoLZjNNy62jc/nl2xACff1Tk
hdI1GXcdXCuJOlNBgzsxnzI=
=kErW
-----END PGP SIGNATURE-----

--=-35IEgf0SUn5GcuxCy0Q6--