无法连接到localhost (provider:命名管道提供程序,error: 40 - 无法打开到 SQL Server 的连接) 1. 确保服务器端的数据库中存在sa,并支持混合登录模式.默认安装的时候,可能会忽略建立sa. 2. 确保服务器端的数据库是支持远程调用的.打开SQL server Management Studio,选择该数据库,右键菜单"Properties",在打开的对话框
中选择Connections,把Allow remote connections to this server选上. 3. 确保服务器端的SQL服务的TCP/IP是Enable的.打开SQL server Configuration Manager. 选择SQL server 2005 Network
Configuration下的Protocols for SQL2005( 我安装的SQL示例名为SQL2005), 把Named Pipes和TCP/IP都修改为Enabled,默认是Disabled. 4. 确保服务器端的SQL实例的远程调用是支持TIP/IP和named pipes的. 打开SQL server Surface Area Configuration Manager,在打开的
页面中选择Surface Area Configuration for Services and Connections.选中实例的Remote Connections,把Using both tcp/IP and named
pipes选中. 5. 重启服务器端的SQL server 2005服务,确保SQL server Agent和SQL server Browser的服务也启动了. 默认都是需要手动启动,可以改