【发布时间】:2017-03-30 15:51:18
【问题描述】:
我一直试图让我的 c# 数据库应用程序在任何地方运行,但使用以下连接字符串时
<add name="DBCS"
connectionString="Data Source=(LocalDB)\v13;AttachDbFilename=|DataDirectory|\ServiceCardRecorderDatabase.mdf;Integrated Security=True;database=ServiceCardRecorderDatabase"
providerName="System.Data.SqlClient" />
当我尝试向表中插入数据时,我得到一个异常提示
System.Data.SqlClient.SqlException: 'A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. The specified LocalDB instance does not exist.
从 Visual Studio 抛出:
【问题讨论】:
-
你没有包含你的连接字符串。
-
请在您的问题中输入错误的文本,而不是将其作为图片包含在内。图片很难搜索,它们需要额外的步骤才能查看、额外的带宽等。
-
请包含一些代码,以便我们查看您的尝试。
-
我不相信这些。我没有看到演示如何将数据插入表中的代码,也没有看到连接字符串,当然也没有看到异常。我确实看到了似乎是指向图像的链接,但据我所知,那是一些非法的东西。如果您想要答案,您需要edit 并修复此问题(代码、连接字符串、完整的异常详细信息)。
-
@WilliamXifaras 是的,他做到了。他只是没有以解析 Markdown 时显示的方式对其进行格式化。我已经更正了。