首页 > 解决方案 > 提供程序:命名管道提供程序,错误:40 - 无法打开与 SQL Server 2012 的连接

问题描述

我收到以下错误:

用户代码未处理 System.Data.SqlClient.SqlException 消息=建立与 SQL Server 的连接时发生与网络相关或特定于实例的错误。服务器未找到或无法访问。验证实例名称是否正确以及 SQL Server 是否配置为允许远程连接。(提供者:命名管道提供者,错误:40 - 无法打开与 SQL Server 的连接)。

这是我的代码:

public DataTable GetAll()
    {
        SqlCommand Command = new SqlCommand("Domain_GetAll", m_Connection);
        Command.CommandType = CommandType.StoredProcedure;

        SqlDataAdapter DAdpt = new SqlDataAdapter(Command);

        DataSet ds = new DataSet();
        DAdpt.Fill(ds,"Domain");**error at this location**
        return ds.Tables["Domain"];
    }

我该如何解决这个错误?

标签: .netsql-server-2012named-pipes

解决方案


推荐阅读