Unable to add data connection. Key not valid for use in specified state.

Using Visual Studio 2005, I am no longer able to add data connections to my projects.

After testing the connection to an existing database and clicking OK, I get the 2-line message "Unable to add data connection. Key not valid for use in specified state."

I am able to work with the databases using sqlcmd and SQL Server Express Manager.

[353 byte] By [GlennBerry] at [2007-12-16]
# 1
Have you checked the VS 2005 Beta site to see if this bug has been reported, or has a workaround
MarcD at 2007-9-9 > top of Msdn Tech,Visual Studio Express Editions,Installing and Registering Visual Studio 2005 Express Editions...
# 2

I found a relevant bug report (FDBK18994) in
http://lab.msdn.microsoft.com/productfeedback/default.aspx
the MSDN Product Feedback Center.

I solved the problem by renaming the VisualStudio folders in
..\Application Data\Microsoft
..\Local Settings\Application Data\Microsoft
to VisualStudioXXX

I had installed Visual Studio Team System (after I got the CD-ROMs in the mail) on top the express editions of Visual C# and Visual Web Developer. I did not experience any problems for several weeks. After renaming the two directories, I have a cleaner looking GUI that has Team Explorer and Class View tabs. I even have File-New-Project. Now I understand why the labs and webcasts have looked different from my version.

GlennBerry at 2007-9-9 > top of Msdn Tech,Visual Studio Express Editions,Installing and Registering Visual Studio 2005 Express Editions...
# 3
This fix is temporary for me. Every time I log off and back on, the problem reoccurs. My work-around is to delete the data connections and rebuild them.
Kevin
knechod at 2007-9-9 > top of Msdn Tech,Visual Studio Express Editions,Installing and Registering Visual Studio 2005 Express Editions...
# 4

This solution worked for me.

1. Open the registry

2. Rename [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0]

To [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0back]

3. Restart Visual Studio

Ali

AliAhmadi at 2007-9-9 > top of Msdn Tech,Visual Studio Express Editions,Installing and Registering Visual Studio 2005 Express Editions...
# 5
After encountering this error, I deleted all unused datasources, some of which didn't work. This seemed to of done the trick.

Therefore, delete any DataSources that do not work.

Kurt

kgooding at 2007-9-9 > top of Msdn Tech,Visual Studio Express Editions,Installing and Registering Visual Studio 2005 Express Editions...
# 6
hey Ali,

If you could explain me what you did. That would be helpful.

Im still getting the same error. """Key not valid for use in specified state"""

And i checked and deleted all the datasource. But still when i try to add a datasource it again shows me the same message. my email id is hiten@nit-me.com.

Thanks pal

Aakash_AIT at 2007-9-9 > top of Msdn Tech,Visual Studio Express Editions,Installing and Registering Visual Studio 2005 Express Editions...
# 7

I have the same thing, Not modified the data sources for ages, now a user wants an item adding to the database so I was about to modify to use the new item and voila.

Nothing works I have removed all the data sources (shows no data sources at all) and I have tried to add a data source and got the same message every time.

I cannot see any other method around this, does MS expect you to completely rewrite the application to get around this?.

snakegamer at 2007-9-9 > top of Msdn Tech,Visual Studio Express Editions,Installing and Registering Visual Studio 2005 Express Editions...