<p>Context: 
I'm in charge of running a service written in .NET. Proprietary application. It uses a SQL Server database. It ran as a user member of the Administrators group in the local machine. It worked alright before I added the machine to a domain.</p>

<p>So, I added the machine to a domain (Win 2003) and changed the user to a member of the Power Users group and now, the</p>

<p>Problem:
Some of the SQL sentences it tries to execute are "magically" in spanish localization (where , separates floating point numbers instead of .), leading to errors. </p>

<blockquote>
  <p>There are fewer columns in the INSERT
  statement than values specified in the
  VALUES clause. The number of values in
  the VALUES clause must match the
  number of columns specified in the
  INSERT statement.    at
  System.Data.SqlClient.SqlConnection.OnError(SqlException
  exception, Boolean breakConnection)</p>
</blockquote>

<p>Operating System and Regional Settings in the machine are in English. I asked the provider of the application and he said:</p>

<blockquote>
  <p>Looks like you have a combination of
  code running under Spanish locale, and
  SQL server under English locale. So
  the SQL expects '15.28' and not
  '15,28'</p>
</blockquote>

<p>Which looks wrong to me in various levels (how can SQL Server distinguish between commas to separate arguments and commas belonging to a floating point number?).</p>

<p>So, the code seems to be grabbing the spanish locale from somewhere, I don't know if it's the user it runs as, or someplace else (global policy, maybe?). But the question is</p>

<p>What are the places where localization is defined on a machine/user/domain basis?</p>

<p>I don't know all the places I must search for the culprit, so please help me to find it!</p>

[{'answer_id': 59070, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 1, 'selected': False, 'text': '<p>You can set it in the thread context in which your code is executing.</p>\n\n<p>System.Threading.Thread.CurrentThread.CurrentCulture</p>\n'}, {'answer_id': 59071, 'author': 'Mark Ingram', 'author_id': 986, 'author_profile': 'https://Stackoverflow.com/users/986', 'pm_score': 3, 'selected': True, 'text': '<p>There are two types of localisation in .NET, both the settings for the cultures can be found in these variables (fire up a .NET command line app on the machine to see what it says):</p>\n\n<p>System.Thread.CurrentThread.CurrentCulture\n&amp;\nSystem.Thread.CurrentThread.CurrentUICulture</p>\n\n<p><a href="http://msdn.microsoft.com/en-us/library/system.threading.thread_members.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.threading.thread_members.aspx</a></p>\n\n<p>They relate to the settings in the control panel (in the regional settings part).\nCreate a .NET command line app, then just call ToString() on the above properties, that should tell you which property to look at.</p>\n\n<p><strong>Edit:</strong></p>\n\n<p>It turns out the setting for the locales per user are held here:</p>\n\n<pre><code>HKEY_CURRENT_USER\\Control Panel\\International\n</code></pre>\n\n<p>It might be worth inspecting the registry of the user with the spanish locale, and comparing it to one who is set to US or whichever locale you require.</p>\n'}, {'answer_id': 59106, 'author': 'Vinko Vrsalovic', 'author_id': 5190, 'author_profile': 'https://Stackoverflow.com/users/5190', 'pm_score': 0, 'selected': False, 'text': '<p>Great, I created the console app and indeed, the app is not crazy, CurrentCulture is in spanish, but for THAT User in THAT machine only. If I run the console app as another user it returns english for all cultures.</p>\n\n<p>Should I open a new question asking where are user-wise locale settings?</p>\n'}, {'answer_id': 59147, 'author': 'Ant', 'author_id': 3709, 'author_profile': 'https://Stackoverflow.com/users/3709', 'pm_score': 0, 'selected': False, 'text': "<p>Well if it's user specific, check out the <em>Regional and Language Options</em> control panel.</p>\n\n<p>&lt;rant&gt;On a side note, kick the developer for not being culture aware when using strings.&lt;/rant&gt;</p>\n"}, {'answer_id': 59162, 'author': 'Vinko Vrsalovic', 'author_id': 5190, 'author_profile': 'https://Stackoverflow.com/users/5190', 'pm_score': 0, 'selected': False, 'text': '<p>Found out why it happened in that machine only. It was the only one where I actually logged into with that user, then the domain controller set the regional settings as spanish for it.</p>\n'}]
['https://Stackoverflow.com/questions/59013', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5190/']