I recently needed to test our program on Windows XP because of a bug that was specific to that OS. So I rebooted a laptop we have that can boot either XP or Windows 8 into XP and installed our software.

Since then, our back-end has been generating "String was not recognized as a valid DateTime" exceptions when the code tries to retrieve data from the database using the Entity Framework Model. Note that the same code works fine on later versions of Windows and other machines running XP. There must be something different about the settings on this laptop.

This error is happening in several different places, but one place it's happening is in the following code:

using ( CarSystemEntities context = new CarSystemEntities() ) {
    IQueryable<CarSystem.Site> childSites = context.Sites.Where( s => s.ParentId == SiteId && s.FromVersion == null );
    if ( childSites.Count() == 0 ) {
    } else {
        foreach ( CarSystem.Site child in childSites ) { // <= Error happens here
            BuildModule( context, child );

The laptop's region is set to en-US. All of the region settings are fine. The application is receiving data from our server and inserting it into the local database properly, so the code in that module is fine. And, as I said, it runs fine on other versions of Windows. It even runs fine on Windows 8 on the same laptop.

We're using SA Anybody got any suggestions?

asked 03 Jan '14, 12:26

TonyV's gravatar image

accept rate: 75%

Hi Tony,

This could be caused by CR#746575 which is fixed in and later.

As a workaround, you should be able to execute:

SET OPTION PUBLIC.timestamp_with_time_zone_format = 'YYYY-MM-DD HH:NN:SS.SSSSSS+HH:NN'

on the server to ensure that the correct time stamp format is set for every connection.

permanent link

answered 03 Jan '14, 13:07

Mikel%20Rychliski's gravatar image

Mikel Rychliski
accept rate: 32%

Thanks, that option command worked. I thought I had executed that statement, but I realize now I probably left off the "PUBLIC." part of it.

(06 Jan '14, 08:57) TonyV
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 03 Jan '14, 12:26

question was seen: 2,873 times

last updated: 06 Jan '14, 08:57