HighTechTalks DotNet Forums  

Load DataSet Error: Cannot add a DataRelation or Constraint...

Visual Studio.net (General) microsoft.public.vsnet.general


Discuss Load DataSet Error: Cannot add a DataRelation or Constraint... in the Visual Studio.net (General) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Gregory Butler
 
Posts: n/a

Default Load DataSet Error: Cannot add a DataRelation or Constraint... - 03-05-2008 , 03:59 PM






I've got a typed data set with several child tables compiled under 'en-US' as
the locale. When the app is run under a different locale (through, e.g.,
changing regional settings, an MUI, etc.), the following exception occurs:

"Failed to load dataset because of the following error:
Cannot add a DataRelation or Constraint that has different Locale or
CaseSensitive settings between its parent and child tables."

This was apparently reported as a VS bug several years ago:

http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=106466

I tried the "change the UseCurrentLocale attribute to false" suggestion, but
to no avail. Ultimately, I had to add the following code to to the
Designer.cs file in the InitClass() method after the last table is added but
before the first relation is created:


this.Locale =
System.Threading.Thread.CurrentThread.CurrentCultu re;

foreach (System.Data.DataTable dt in base.Tables)
{
dt.Locale = this.Locale;
}

This is the only solution that I've found effective, but obviously consider
it inadequate since I had to alter generated code. Note that I am using this
version 8.0.50727.762 of VS and 2.0 SP1 of .NET.

Any feedback would be appreciated. Thanks

Reply With Quote
  #2  
Old   
Michael Collins
 
Posts: n/a

Default Re: Load DataSet Error: Cannot add a DataRelation or Constraint... - 02-17-2012 , 11:00 AM






I also tried the "change the UseCurrentLocale attribute to false" suggestion, but to no avail.

Then I discovered on another Microsoft site (see below) that if you change the UseCurrentLocale attribute to false, you must also make sure that the dataset element also has the attribute msdata:Locale="en-us", which in my case, didn't exist, and I had to add it.

That fixed the error for me.

http://msdn.microsoft.com/en-us/library/ff420727.aspx


Quote:
On Wednesday, March 05, 2008 4:59 PM GregoryButle wrote:

I've got a typed data set with several child tables compiled under 'en-US' as
the locale. When the app is run under a different locale (through, e.g.,
changing regional settings, an MUI, etc.), the following exception occurs:

"Failed to load dataset because of the following error:
Cannot add a DataRelation or Constraint that has different Locale or
CaseSensitive settings between its parent and child tables."

This was apparently reported as a VS bug several years ago:

http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=106466

I tried the "change the UseCurrentLocale attribute to false" suggestion, but
to no avail. Ultimately, I had to add the following code to to the
Designer.cs file in the InitClass() method after the last table is added but
before the first relation is created:


this.Locale =
System.Threading.Thread.CurrentThread.CurrentCultu re;

foreach (System.Data.DataTable dt in base.Tables)
{
dt.Locale = this.Locale;
}

This is the only solution that I've found effective, but obviously consider
it inadequate since I had to alter generated code. Note that I am using this
version 8.0.50727.762 of VS and 2.0 SP1 of .NET.

Any feedback would be appreciated. Thanks

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.