Could not open a connection to SQL Server)

来源:百度知道 编辑:UC知道 时间:2024/04/29 10:05:00
我用sql和VS远程连接数据库均可以打开,但是发布以后,当输入网址后提示:An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
为什么连接不上数据库了呢?请高手该处解决方法

你可能是用服务器名称建立连接字符串的,你必须改为ip连接.

provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server

这个错误告诉你不能通过命名管道解析服务器.

改成IP吧

第一,确定你的SQL Server已经允许Remote连接。
第二,如楼上所说,指定IP和端口。
格式:ip,端口(默认端口是1433)
例如:192.168.111.222,1433