5

In Visual Studio 2008, I have database connections in the Server Explorer window that point to SQL Server databases installed locally on my PC.

When I delete one of the connections in goes, but next time I start Visual Studio is is back again.

Does anyone know how to remove them properly?

It isn't a big deal, but it is a bit annoying.

Thanks.

Steve Jones
  • 3,377
  • 3
  • 17
  • 12

6 Answers6

2

I found the solution to this problem by noticing that the 'deleted' Database Connections only re-appear in Server Explorer when I open the Solution file (previously, I had VS set to open the last project on start-up).

So, knowing it must be something in the solution, I searched the files and I have a Database Project which holds build scripts, etc. In this project, within the *.dbp file, there is a "DBRefFolder" section. The 'deleted' database references were here, and when I deleted them, all was well.

It is a bit annoying that VS doesn't remove these entries properly, but at least I have a solution.

Below is an sample extract from the *.dbp file:

Begin DataProject = "SQL Server Databases"
    ...
    ...
    ...
    ...
    Begin DBRefFolder = "Database References"
        Begin DBRefNode = "Name"
            ConnectStr = "Data Source=XXX;Initial Catalog=YYY;Integrated Security=True"
            Provider = "{91510608-8809-4020-8897-FBA057E22D54}"
            Colorizer = 6
        End
        ...
        ...
        ...
        ...
    End
End
Steve Jones
  • 3,377
  • 3
  • 17
  • 12
1

Just delete your web.config or other config files like app.config connection strings that you don't need them again. I test it for about half a day and deleting the unneeded connection strings from config file help me not loading again that connection string in server explorer of visual studio 2012. Wish you luck

mostafakvd
  • 86
  • 1
  • 2
  • 10
0

Delete them, close Visual Studio, clear your ASP.NET Temporary Files, then start Visual Studio.

Chuck Callebs
  • 16,293
  • 8
  • 56
  • 71
0

VisualStudio doesn't actually save every little project or worspace setting change you make. I often find things like added or removed projects are back to the way they were before if I shutdown my machine without first nicely exiting out of VS.

So I'd highly suggest closing nicely out of VS after making any setting change you don't want lost.

You'd think a Microsoft-built program wouldn't be the one program I use that can't handle a shutdown request properly and has to be manually closed first, but nooooo....

T.E.D.
  • 44,016
  • 10
  • 73
  • 134
0

I used notepad++ "Find in Files" function to search the data connection name, I believe you can search the following folder:

C:\Users\YOURNAME\Documents\Visual Studio 2013\

The following file has the data connection:

C:\Users\YOURNAME\Documents\Visual Studio 2013\WebSites\WebSite1\Web.config

Delete the following statement which has the data connection:

< add name="YOURCONNECTIONSTRINGNAME" connectionString="server=****;user id=****; database=****; ersistsecurityinfo=True; password=****" providerName="MySql.Data.MySqlClient" />

elin
  • 538
  • 4
  • 6
0

Steve, I have been dealing with this issue for a couple of days. Not only was I not able to remove the old connection, but I was also unable to add a new connection.

Here is what I found after searching high and low.

On Windows 7 and perhaps Vista try renaming or deleting this file "DefaultView.SEView" in this folder C:\Users...\AppData\Roaming\Microsoft\VisualStudio\9.0\ServerExplorer

Someone else said to remove the file from AppData\Local but that's just not right.

Jason Foglia
  • 2,414
  • 3
  • 27
  • 48