2014-10-12 66 views
0

我有一个数据库,名为Library,在我本地创建的服务器实例下创建于SQL Server 2014中。我在Windows窗体应用程序中使用该数据库作为数据源。这是完全工作时,我的电脑,但是当我在其他机器上运行它,它与使用C#应用程序对使用SQL Server 2014创建的数据库进行远程访问Management Studio

Unhandled exception occurred...

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: Named Pipes Provider, error: 40 - could not open connection to SQL Server)

我已经开始从配置管理器中的所有服务,并在协议已经启用了TCP/IP协议为MSSQLSERVER错误停止。有什么办法可以做到这一点,还是我必须转移到本地数据库?

回答

1

确保您的连接字符串包含您的远程计算机的名称为“数据源”的一部分,所以是这样的: 的connectionString =“数据源=计算机名\的SQLExpress;初始目录= mydbname;集成安全性=真”

请注意,此连接字符串将在具有SQL Express实例的计算机machinename下面以db名称“mydbname”为目标。

如果没有工作,让我看看你的连接字符串。

+0

您能否详细说明您所说的“配置字符串”?我的连接字符串是: 'Data Source = NILADRI-HP; Initial Catalog = BookLibrary; Integrated Security = True; Encrypt = False' – Nil 2014-10-12 11:54:16

+0

您好无,我的意思是连接字符串,现在查找您的连接字符串,您正在使用您的Windows凭据可以访问远程数据库,因此请确保使用您的Windows用户名/密码,您可以连接到NILADRI-HP,并通过SQL Management Studio完全访问“BookLibrary”数据库,如果您不需要连接例如在NILADRI机器上使用用户名/密码设置,具有对BookLibrary数据库的读/写访问权限。 – 2014-10-13 12:37:00

相关问题