Error When Dropping a TableAdapter onto the DataSet Designer
Can someone out there in the blogosphere explain this error? I get it intermittently when trying to drop a table from a Data Connection onto my typed-DataSet designer:
It also occurs if I try to create a TableAdapter "manually", by right-clicking and selecting "Add|TableAdapter..." - Visual Studio lets me step all the way through the wizard and then throws this error.
I've seen this error at work with the full Visual Studio, and now I'm seeing it at home in Visual C# Express, so it's not limited to any single version.
If I could even determine that the error occurred only under certain circumstances, I'd at least be some way towards working out its cause. As it is, I can't pick it at all. When it happens, it happens every time, and I can't add a TableAdapter at all. At other times I'll have no troubles.
For the search engines, here's the text of the error:
An unexpected error has occurred. Please record the following message when seeking support from Microsoft: Source:Microsoft.VSDesigner ErrorCode:-1 Additional Info:
What do you think, guys? Seen it? Fixed it? Can you help?

Comments
# krzak
18/03/2007 11:24 AM
Man... I have the same problem, and no clue WTF. Did you found any solution ?
# mabster
18/03/2007 1:41 PM
Unfortunately, no. And it happens so infrequently that it's impossible to pin down exactly what causes it. :(
# krzak
19/03/2007 9:26 AM
I found out that it's related to foreign keys defined in database, but seems not only. It's so wired. Currently this stop my development because I can't update dataset after I update database structure hehe. Nice.
# Lauri Peltonen
3/07/2007 1:25 AM
Make sure you have the primary key defined for the tables you have foreign key references (Relations) to. Seems to crash when it finds no primary key on the other end of a relation..
Worked for me at least! (VS 2005 TE + SQL Server 2005)
# Infidel
28/06/2008 7:41 PM
I tried going with Krzak's suggestion, removed the relationship I had with a non essential table and I was able to add the tableadapter.
It bugged me for the first time the other day and i fixed it, but didn't know how. Next time it happens i'll try the relationship idea again and see what happens... might be the key (scuse the pun).
Thx Krzak!
# q john chen
5/08/2008 3:20 AM
I had same problem with VS2008/SQL Compact
forums.microsoft.com/.../ShowPost.aspx
# kyalami
31/12/2008 1:32 AM
I had the same problem. The table I was trying to add (table A) is related to a table that is in my DataSet (table B). Solution: Delete table B in the DataSet, select table A and B in the Server Explorer (CTRL-select) and drag both tables at the same time on to the DataSet. It worked.