title: configuring date formats with Windows 7/.NET/SQL Server
body: <p>I recently copied a web application to a new install of Windows 7 and SQL Server 2008 R2. The application uses LINQ to SQL. Somewhere along the line the parsing of POSTed date strings got screwed up. When the user enters a date string like <code>4/23/2011</code>, the application rejects it, throwing the error <code>The value '04/23/2011' is not valid for Due.</code> Due (actually DueDate) is a DateTime field in SQL Server.</p>
  
  <p>This used to work fine. I assumed it was an issue with the machine's OS internationalization settings, so I checked and the short and long date formats are set to <code>MM/dd/yyyy</code> and <code>dddd, MMMM dd,yyyy</code> respectively, which looks OK to me. The SQL Server database language is set to English.</p>
  
  <p>The partial class for this property looks like this:</p>
  
  <pre><code>[DisplayName("Due")]
  [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:MM/dd/yyyy}")]
  public DateTime? DueDate { get; set; }
  </code></pre>
  
  <p>There must be another date format setting I need to tweak. Where should I be looking? </p>
  
  <p>Note: this may be more correctly a serverfault question, but I think devs are much more likely to run into this issue than sysadmins.</p>
  
  <p><strong>More info:</strong> <code>SP_CONFIGURE 'default language'</code> returns:</p>
  
  <pre><code>default language    0   9999    0   0
  </code></pre>
  
  <p><strong>Also:</strong> the default language for the database login I am using is English.</p>