We busy running c# asp website with MS SQL DB.
Some of the columns have been assigned type decimal(18,2).
SqlCommand cmd = new SqlCommand("select * from TABLE", conn);
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
Response.Write("Amount : " + dr["DEC_COLUMN"].ToString());
}
On my colleagues localhost, when he does a simply select, values come back as 10.01 10.02 15.03 On my localhost it comes back as 10,01 10,02 15,03
My colleague and our Dev Server has the same values. Apart from the string replace hacks, I would like to get my settings the same so that my values also return with point not comma.
I checked the regional settings on my PC and its the exact same as the Dev server. I dumped my local DB and used the Export / Import wizard from Dev server but still no luck.
Which setting in windows / .NET / SQL is needed to be changed to make my local environment the same?
But since my copy of source code is the same as my colleages as well as that of dev server, all controlled by SVN, how could it differ?
Because the default system culture isn't defined in the source code.
I very much doubt that you really want to write a response in exactly that format anyway, but you could always specify the invariant culture:
while (dr.Read())
{
decimal value = (decimal) dr["DEC_COLUMN"];
Response.Write("Amount : " + value.ToString(CultureInfo.InvariantCulture));
}
See more on this question at Stackoverflow