views:

24

answers:

3

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.

+1  A: 

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

treefrog
That doesn't work. The old Data Connection just comes back right away.
Steve Jones
A: 

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.
I always exit via the File menu in VS, so it can't be that.
Steve Jones
+2  A: 

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