在我的笔记本电脑上的SQL服务器下重复LocalDB

发布于 2025-02-07 10:33:26 字数 444 浏览 3 评论 0原文

我一直在遇到问题。

最近,当我尝试任何涉及使用SQL数据库,实体框架,Dapper等的教程时, 在SQL服务器下相同的LocalDB。此外,然后我尝试发布,数据库并未在我选择的localDB下显示。

我想知道如何去删除其他SQL服务器,而只需提供一个可用的服务器。

如果您查看下图,则浏览选项会给我两个相同的LocalDB。另外,在\ ProjectModels下,我还获得了第三个。我想知道是什么原因造成了这一点,如何将其修复,因为无论我选择哪一个,我尝试发布的SQL数据库都不会在其中任何一个中显示。

I've been running into an issue recently when I attempt any tutorials that involve using a SQL database, entity framework, dapper, etc.

When it comes time to publish a database, or utilize an ORM, I'm given duplicate options for the same localdb under SQL Servers. Furthermore, then I attempt to publish, the database doesn't show up under the localdb that I've chosen.

I'm wondering how I go about removing the other SQL Servers and just having the one available.

If you look at the image below, the Browse option gives me two of the same LocalDbs. Plus I also get a 3rd one under \ProjectModels. I'm wondering what's causing this and how it can be fixed since no matter which one I choose, the sql database I attempt to publish doesn't show up within any of them.

enter image description here

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

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

发布评论

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

评论(1

一页 2025-02-14 10:33:26

我的建议是不要使用此方法发布数据库。 (右键单击删除)

请参阅此官方文档。

基于文件的数据库(例如SQLite或SQL Server Express)旨在将其数据存储在可与您的应用程序/站点一起使用的易于传输的文件中。

“复制到输出目录”数据库文件的属性属于“复制新的”。只需将地址指向它。

如果您使用的是基于服务器的数据库,例如SQL Server,MySQL等,则需要确保目标机器/环境已安装了相同的数据库服务器,并且需要编写一个部署脚本来附加预处理数据文件到服务器。这对您来说可能很麻烦。

您也可以参考这些链接。 1 2 3

My advice is not to use this method to publish the database. (right click to delete)

Please refer to this official documentation.

File-based databases like SQLite or SQL Server Express are designed to store their data in easily transferable files that can be served with your application/site.

"Copy to Output Directory" Property of the database file to "Copy if newer". Just point the address to it.

If you are using a server-based database like SQL Server, MySQL, etc., you need to make sure that the target machine/environment has the same database server installed, and you need to write a deployment script to append the pre-populated data files to the server. This might be troublesome for you.

You can also refer to these links. 1,2,3

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