Hi Miha... it's me again...
I've tried the following code:
CultureInfo myCI = new CultureInfo("es-ES", false);
myCI.NumberFormat.NumberGroupSeparator = ".";
myCI.NumberFormat.NumberDecimalSeparator = ",";
System.Threading.Thread.CurrentThread.CurrentCulture = myCI;
I did it before reading the source DataSet. Even changing the regional
settings the error remains the same. I am still making researchs on the
web... I thought it would be easier to solve...
see you...
Andre Botelho
--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
After you read the data in, and you check in your dataset, is the value
correct? Is the column a numeric column in the dataset? I am wondering if
this is an issue with the machine you are running your application on, or on
the database server (which can have its own regional settings).
> Hi Miha... it's me again...
>
[quoted text clipped - 16 lines]
> Sent via .NET Newsgroups
> http://www.dotnetnewsgroups.com
Cor Ligthert [MVP] - 09 Jan 2006 16:19 GMT
Marina,
This is a strange problem. My settings are Dutch which have almost
completely the same behaviour as the Spanish even the currency sign.
This code (I had VB test project open and was to lazy to start a new C#
project)
\\\
Dim dt As New DataTable("Marina")
dt.Columns.Add("DecimalTest", GetType(System.Decimal))
dt.LoadDataRow(New Object() {23.0402}, True)
dt.WriteXml("c:\test1\marina.xml")
///
Creates this XML file
\\\
<?xml version="1.0" standalone="yes" ?>
- <DocumentElement>
- <Marina>
<DecimalTest>23.0402</DecimalTest>
</Marina>
</DocumentElement>
///
In an XML file and in a SQLserver the decimal seperator is just a dot.
(with a toString it is represented with a comma for me 23,0402)
The region settings are AFAIK not important.
Cor
Cor Ligthert [MVP] - 09 Jan 2006 16:46 GMT
Doh,
The dot is of course not in SQL Server in that it are just value types in
which the decimal pointer is integrated.
Cor
Andre Botelho - 09 Jan 2006 16:30 GMT
Hi Marina...
I have just solved the problem some hours ago... it was exactly what
Miha told. The digital separator in the XML file is "." but my machine
is configured for ",".
In my previous post I said that I was trying to change the regional
configuration and it was not working, my failure, it does work.
I use the following code before parsing the DataSet and apply the
changes I want:
CultureInfo myCI = new CultureInfo("en-US", false);
myCI.NumberFormat.NumberGroupSeparator = ",";
myCI.NumberFormat.NumberDecimalSeparator = ".";
System.Threading.Thread.CurrentThread.CurrentCulture = myCI;
Now it is working fine... it is reading the value 23.0402 as 23,0402
instead of 230402,0000.
Thank you all for the help. I hope this issue will be usefull for others
in the future.
bye,
Andre Botelho
--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
Miha Markic [MVP C#] - 09 Jan 2006 19:19 GMT
Hi Andre,
You might also want to use CultureInfo.InvariantCulture (instead of setting
the separators yourself) which is sort of independent one.

Signature
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
> Hi Marina...
>
[quoted text clipped - 26 lines]
> Sent via .NET Newsgroups
> http://www.dotnetnewsgroups.com
Andre Botelho - 10 Jan 2006 13:25 GMT
Thanks for this tip Miha!
Andre Botelho
--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com