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.
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.
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
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
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
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?.