This article has been archived. It is offered "as is" and will no longer be updated.
Consider the following scenario:
You create two tables. In the first table, you set the ID column as the primary key column.
You set up the primary-key-to-foreign-key (PK-FK) relationship between the tables. However, the primary key column is not the column that you reference in the PK-FK relationship.
In Microsoft Visual Studio 2008, you create a project, and then you try to add the tables as a new data source.
On the Choose Your Database Objects page of the Data Source Configuration Wizard, you select the tables, and then you click Finish.
In this scenario, you receive the following error message in the Data Source Configuration Wizard:
Failed to add relation(s) Unexpected error.
Additionally, if you right-click the dataset and then click Edit Dataset with Designer, the relationships between the tables are not displayed.
A supported hotfix is now available from Microsoft. However, it is intended to correct only the problem that is described in this article. Apply it only to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next service pack that contains this hotfix.
To resolve this problem immediately, contact Microsoft Customer Support Services to obtain the hotfix. For a complete list of Microsoft Customer Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:
Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.
You must have Visual Studio 2008 installed to apply this hotfix.
You do not have to restart the computer after you apply this hotfix.
Hotfix replacement information
This hotfix does not replace any other hotfixes.
The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel.
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
Steps to reproduce the problem
Create a table that has two columns, set the ID column as the primary key column, and then set the other column as an indexed column. To do this, use the following statement.
create table t1(c1 int, c2 uniqueidentifier primary key)create unique index idx_c1 on t1(c1)
Create a second table by using the following statement.
create table t2(c3 int, c4 int)
Set up the PK-FK relationship, and then reference the indexed column in the first table. Do not reference the actual primary key column. To do this, use the following statement.
alter table t2 WITH CHECK ADD CONSTRAINT fk_c3t2_c1t1 FOREIGN KEY(c3) REFERENCES t1 (c1)
In Visual Studio 2008, click New project on the File menu, click Windows Forms Application, and then click OK.
On the Data menu, click Add New Data source, select the database source where you created the two tables, and then click Next.
On the Choose Your Database Objects page of the Data Source Configuration Wizard, select the t1 table and the t2 table, and then click Finish.
For more information about software update terminology, click the following article number to view the article in the Microsoft Knowledge Base:
824684 Description of the standard terminology that is used to describe Microsoft software updates
Microsoft Visual Studio Team System 2008 Database Edition, Microsoft Visual Studio Team System 2008 Architecture Edition, Microsoft Visual Studio Team System 2008 Development Edition, Microsoft Visual Studio Team System 2008 Test Edition, Microsoft Visual Studio Team System 2008 Team Suite, Microsoft Visual Studio 2008 Standard Edition, Microsoft Visual Studio 2008 Professional Edition