建立与SQL Server的连接时发生与网络相关或特定于实例的错误.... [英] A network-related or instance-specific error occurred while establishing a connection to SQL Server....

查看:60
本文介绍了建立与SQL Server的连接时发生与网络相关或特定于实例的错误....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用c#和SqlServer 2008开发了一个数据库....



i进行exe设置并安装在另一台计算机上这次我安装sqlexpress版本

i导入数据文件,但是当我运行应用程序时,我收到以下错误..



 System.Data。 SqlClient.SqlException:发生与网络相关的特定于实例的错误,而建立连接  SQL Server。服务器找到 无障碍。验证实例名称 正确 SQL Server 配置 允许远程连接。 (提供商:命名管道提供商,错误: 40   - 可能 打开连接 SQL Server)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception,Boolean breakConnection)

解决方案

未找到服务器或无法访问服务器。

要解决此问题,您应该

验证实例名称是否正确,并且SQL Server配置为允许远程连接。


获取您的SQl实例名称:



 SQL Server实例名称:

SQL Server Management Studio-> RegisterServers- >双击您的服务器 打开对象资源管理器 - > 正确点击 选择属性窗口 - >常规标签 - 查看ServerName(实例名称)



SQL Server管理窗口新查询代码关键字>和 执行以下

- 获取sql server实例名称

选择 @@服务器名称


i developed a database using c# and SqlServer 2008 ....

i make an exe setup and installed in another computer this time i install sqlexpress edition
i import the data file but when i run the application i got the following error..

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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)

解决方案

The server was not found or was not accessible.
To solve the problem, you should
Verify that the instance name is correct and that SQL Server is configured to allow remote connections.


Get your SQl Instance Name:

SQL Server Instance Name :

In SQL Server Management Studio->RegisterServers->double click your server to open the Object Explorer -> right click to select the properties window ->General Tab - to see the ServerName (instance name)



or Open a new query in SQL Server Management window  and execute the following

-- to get the sql server instance name

select @@ServerName


这篇关于建立与SQL Server的连接时发生与网络相关或特定于实例的错误....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆