sqldatareaderobject.GetDecimal("ColumnName") is not taking comma as decimal separator
-
samedi 11 août 2012 09:27
Hi,
Our production server(Sql Server 2008 R2) in iceland and stores money column values as 234,67.
We are trying to read the column values as following way.
sqldatareaderobject.GetDecimal("<ColumnName>") then it returns as 23467. But it supposed to be returns as 234.67.
Please help me in this issue.
-Mastan
- Déplacé Bob ShenMicrosoft Contingent Staff vendredi 17 août 2012 09:20 (From:Visual C# General)
Toutes les réponses
-
samedi 11 août 2012 10:52
You haven't specified the type of application.
But you should put this before the creation of the object of your interface:
Application.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("yourCulture");
Replace the yourCulture string, with a string representing the culture you need(i.e en-US for the US, de-DE for Germany). -
lundi 13 août 2012 07:35
Hi,
This is ASP.Net application with C#
-
lundi 13 août 2012 09:43
Hi masthan80864,
You are more likely to get more efficient responses to ASP.NET issues at http://forums.asp.net where you can contact ASP.NET experts.
Bob Shen [MSFT]
MSDN Community Support | Feedback to us
-
lundi 13 août 2012 12:05
Hi try this one i think it will help to u :(
string s=sqldatareaderobject["<ColumnName>"].ToString();
decimal d = decimal.Parse(s.Replace(',','.'), System.Globalization.NumberStyles.AllowDecimalPoint);
programmer on .net
- Modifié programmer on .net lundi 13 août 2012 12:18

