title: How do you map a CultureInfo name to the CurrentLanguage of a SqlConnectionString?
body: <p>I am attempting to dynamically specify the <a href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnectionstringbuilder.currentlanguage%28v=VS.100%29.aspx" rel="nofollow">CurrentLanguage</a> of the SQL connection strings used by an application at runtime based on the current culture information of the application.</p>
  
  <p>My initial attempt was the following:</p>
  
  <pre><code>foreach (ConnectionStringSettings item in ConfigurationManager.ConnectionStrings)
  {
      if (!this.ConnectionStrings.ContainsKey(item.Name))
      {
          SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(item.ConnectionString);
          if (String.IsNullOrEmpty(builder.CurrentLanguage))
          {
              var culture = Thread.CurrentThread.CurrentUICulture ?? Thread.CurrentThread.CurrentCulture;
              builder.CurrentLanguage = culture.Name;
          }
  
          this.ConnectionStrings.Add(item.Name, builder.ToString());
      }
  }
  </code></pre>
  
  <p>This however fails, as the <a href="http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.name.aspx" rel="nofollow">Name</a> of the <a href="http://msdn.microsoft.com/en-us/library/kx54z3k7.aspx" rel="nofollow">CultureInfo</a> does not map the the name in the <a href="http://msdn.microsoft.com/en-us/library/ms190303.aspx" rel="nofollow">sys.syslanguages</a> of SQL server.</p>
  
  <p>Is there a way to map one of the CultureInfo name properties to a SQL server language name, or am I stuck calling a user defined function that accepts an LCID and maps that to the appropriate name to pass to <a href="http://msdn.microsoft.com/en-us/library/ms174398.aspx" rel="nofollow">SET LANGUAGE</a>?</p>