为什么删除的数据连接会在 Visual Studio 中恢复?

发布于 2024-09-10 08:11:50 字数 186 浏览 5 评论 0原文

在 Visual Studio 2008 中,服务器资源管理器窗口中的数据库连接指向本地安装在我的 PC 上的 SQL Server 数据库。

当我删除其中一个连接时,但下次启动 Visual Studio 时,它又回来了。

有谁知道如何正确删除它们?

这没什么大不了的,但是有点烦人。

谢谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

辞别 2024-09-17 08:11:50

我发现这个问题的解决方案是,当我打开解决方案文件时,“已删除”的数据库连接只会重新出现在服务器资源管理器中(以前,我将 VS 设置为在启动时打开最后一个项目)。

因此,知道它一定是解决方案中的某些内容,我搜索了文件,并且有一个包含构建脚本等的数据库项目。在这个项目中,在 *.dbp 文件中,有一个“DBRefFolder”部分。 “已删除”的数据库引用在这里,当我删除它们时,一切都很好。

VS 没有正确删除这些条目有点烦人,但至少我有一个解决方案。

以下是 *.dbp 文件的示例摘录:

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

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
晚雾 2024-09-17 08:11:50

只需删除您不再需要的 web.config 或其他配置文件(例如 app.config 连接字符串)即可。
我测试了大约半天,从配置文件中删除不需要的连接字符串帮助我不再在 Visual Studio 2012 的服务器资源管理器中加载该连接字符串。
祝你好运

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

淡看悲欢离合 2024-09-17 08:11:50

删除它们,关闭 Visual Studio,清除 ASP.NET 临时文件,然后启动 Visual Studio。

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

可可 2024-09-17 08:11:50

VisualStudio 实际上并不保存您所做的每个小项目或工作空间设置更改。我经常发现,如果我在没有先退出 VS 的情况下关闭计算机,添加或删除项目之类的事情就会恢复到以前的状态。

因此,我强烈建议在进行任何您不想丢失的设置更改后,很好地关闭 VS。

您可能会认为 Microsoft 构建的程序不会是我使用的唯一一个无法正确处理关闭请求并且必须首先手动关闭的程序,但是不......

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

玩心态 2024-09-17 08:11:50

史蒂夫,我已经处理这个问题几天了。我不仅无法删除旧连接,而且也无法添加新连接。

这是我在高低搜索后发现的。

在 Windows 7 或 Vista 上尝试重命名或删除此文件“DefaultView.SEView”
在此文件夹中 C:\Users...\AppData\Roaming\Microsoft\VisualStudio\9.0\ServerExplorer

其他人说从 AppData\Local 中删除该文件,但这是不对的。

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.

会发光的星星闪亮亮i 2024-09-17 08:11:50

我使用notepad++“在文件中查找”功能来搜索数据连接名称,相信您可以搜索以下文件夹:

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

以下文件具有数据连接:

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

删除以下具有数据连接的语句:

<
添加名称=“您的连接字符串名称”
连接字符串=“服务器=****;用户ID=****;
数据库=****;
ersistsecurityinfo=真;
密码=****”
providerName="MySql.Data.MySqlClient"/>

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" />

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文