473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Configuracion regional

Hola!

Tengo un problema con la configuracion regional y SqlServerCe. Tengon un
numero (2,234 por ejemplo) almacenado en una BD que lo representa como
2.234, si desde mi prigrama hago un aconversion con Syste.convet.ToDoble
obtengo el numero 2234 en vez de 2,234. Como puedo convertir al número
correcto? existe alguna función para reemplazar una cadena por otra?,
remplazaria el "." por ","
No me interesa cambiar la configuración regional
Gracias
Nov 16 '05 #1
4 9503
Hi,

Please use english language

--
Regards,
Peter Jausovec
(http://blog.jausovec.net)
"Felix González" <fe************@gvgest.es> je napisal v sporoèilo
news:OU**************@TK2MSFTNGP10.phx.gbl ...
Hola!

Tengo un problema con la configuracion regional y SqlServerCe. Tengon un
numero (2,234 por ejemplo) almacenado en una BD que lo representa como
2.234, si desde mi prigrama hago un aconversion con Syste.convet.ToDoble
obtengo el numero 2234 en vez de 2,234. Como puedo convertir al número
correcto? existe alguna función para reemplazar una cadena por otra?,
remplazaria el "." por ","
No me interesa cambiar la configuración regional
Gracias

Nov 16 '05 #2
Sorry I mistake the grup
"Peter Jausovec" <pe***@jausovec.net> escribió en el mensaje
news:O7**************@tk2msftngp13.phx.gbl...
Hi,

Please use english language

--
Regards,
Peter Jausovec
(http://blog.jausovec.net)
"Felix González" <fe************@gvgest.es> je napisal v sporoèilo
news:OU**************@TK2MSFTNGP10.phx.gbl ...
Hola!

Tengo un problema con la configuracion regional y SqlServerCe. Tengon un
numero (2,234 por ejemplo) almacenado en una BD que lo representa como
2.234, si desde mi prigrama hago un aconversion con Syste.convet.ToDoble
obtengo el numero 2234 en vez de 2,234. Como puedo convertir al número
correcto? existe alguna función para reemplazar una cadena por otra?,
remplazaria el "." por ","
No me interesa cambiar la configuración regional
Gracias


Nov 16 '05 #3
Translation:

"I have a problem with regional configuration and SqlServerCe. I have a
number (2.234 for example) stored in a database that represents it as
2.234. If in my program I do a conversion with
System.Convert.ToDouble(), I get the number 2234 instead of 2,234. How
can I convert to the correct number? Is there some function to replace
one string with another? replace the "." for a ","? I'm not interested
in changing the regional configuration."

I suspect that the problem here is that the conversion from a string to
a double value. Because the regional configuration indicates the "."
(period) as the thousands separator, and the "," (comma) as the decimal
point, ToDouble is interpreting "2.234" as 2234 rather than as a number
just a little bigger than 2.

The solution is to provide an IFormatProvider on the ToDouble
conversion:

double valor = System.Convert.ToDouble(valorCadena,
CultureInfo.InvariantCulture);

This indicates to ToDouble that it should convert the string to a
double, _not_ using the current user interface culture, but using the
"invariant culture".

Tienes que dar a ToDouble un IFormatProvider, que indica la cultura
para la conversión. Proababilmente quieres la cultura invariable,
"CultureInfo.InvariantCulture". Cuando almacenas datos de / para un BD,
es _siempre_ mejor usar InvariantCulture... asi no almacenas datos en
forma especifica a una cultura en particolar.

Ese no cambia la configuración regional del BD ni de la computadora...
solo para la conversión de cadena a doble.

Si no das un IFormatProvider a ToDouble, va a usar la cultura de la
computadora, que parece que en tu caso indica "," como separador de
decimal.

Nov 16 '05 #4
In future, a good group for this kind of question in Spanish is
microsoft.public.es.dotnet.framework, although there are always those
of us here who can reply in our crappy Spanglish. :-)

Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Grumfish | last post by:
Is there a way to tell Java what localization to use so applications and the compiler doesn't default to the system's setting? I'm using a computer with Windows 2000 with a regional setting of...
1
by: nerman | last post by:
Hello I have a problem with the regional settings. I have set the regional settings of the web server to display the numbers in this format 123.456,78 But when I open my web site all number are...
1
by: Laurence Neville | last post by:
This is regarding a change in the Short Date format under Hebrew Regional Settings, that has caused huge problems in our ASP web application. The change appears to have been introduced sometime...
4
by: Jonathan | last post by:
Dear All, I am trying to set a webserver to use French regional settings for testing ASP pages. According to http://support.microsoft.com/kb/q306044, for IIS5, this is a matter of changing...
6
by: Niyazi | last post by:
Hi, We have and IBM AS400 and I belive the reional setting is Turkish. The IBM Client-Access for Windows that install in our PC (WIN XP SP2) set to Turkish characters. Now my PC has English...
2
by: Bob Dydd | last post by:
Hi Everbody Question Changing the regional settings ie. from UK to US AUS etc, Access retains the original currency format that the application was created in. So if an mdb that is written...
1
by: John | last post by:
Hi, The following behavior when using J# vs. C# is really bothering me. When I have the regional settings on my workstation set to a non-US settings (eg: Danish); it seems that J# disregards...
12
by: magister | last post by:
Hello, I know I can set the Culture to what I want, but shouldn't the current culture be taken from the regional settings on the web server's control panel!!! Mine is set to "united kingdom"...
0
by: Marcos Beccar Varela | last post by:
Hola, saben como puedo hacer para que cada vez que un usuario ejecute el sistema el cual estoy armando, cambie automaticamente la configuracion regional y use asi decimales separados por "." y no...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.