Last post Mar 13, 2011 05:09 PM by NickLocke
Mar 10, 2011 08:16 AM|NickLocke|LINK
I have this in the system.web section of web.config:
<globalization culture="auto" uiCulture="auto"/>
Elsewhere, I have this code:
Dim CountryTable As Data.ReferenceData.CountryDataTable = CountryAdapter.GetDataByActiveOnly()
There's nothing clever going on in the dataset - it's a simple SELECT. Everything works fine when my browser has the default settings. But, as soon as I change the browser language to cy-GB, the line of code above fails with:
Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.
I'm probably missing something obvious, but can't see why changing the language in the browser causes a [seemingly] unrelated data retrieval operation to fail.
Pointers welcome! Thanks, Nick.
Mar 10, 2011 09:08 AM|mehta.rahulit|LINK
Mar 10, 2011 09:24 AM|NickLocke|LINK
Mar 12, 2011 02:59 AM|NickLocke|LINK
To recap, in my ASPX I have a dropdown list which is attached to an Object Data Source which is actually a simple dataset created in Visual Studio that just retrieves all the rows from a given table (there are no parameters).
The ASPX displays with the dropdown holding the list of rows from the database - exactly as expected. BUT if I change my browser language to cy-GB, the dataset retrieval falls over with the error noted above. So, two questions:
Mar 13, 2011 05:09 PM|NickLocke|LINK
I have got it working, but I'm not sure how or why....
The dataset had its locale set to English (United Kingdom). On a hunch, I changed that to Default, rebuilt and then the dataset retrieved perfectly ok with the browser set on cy-GB.
Then I changed the dataset locale back to English (United Kingdom), expecting the problem to re-appear. It didn't! So now it's working fine with the dataset locale set to English (United Kingdom).
So, it looks like something about the change / rebuild / change back / rebuild has fixed things.
One more question - best practice on how to set the locale in a dataset, and why?