This failure may occur if SQL server does not allow remote connection under the default settings.

Source: Internet
Author: User
1. An error occurred while establishing a connection with the server. When you connect to SQL Server 2005, the default setting does not allow remote connection to SQL Server may cause this failure. (Provider: named pipeline provides Program , Error: 40-unable to open the connection to SQL Server)


1. Open remote connection, enable SA account, set windows verification please view

2. if the above method does not solve the problem, it is likely to be a connection string error. If SQL Server 2005 Express is used, the connection string must be written in the following method. Remember to add "Express ", I am prompted for this error because of this problem.
<Add key = "connectionstring" value = "Server = localhost \ sqlexpress; uid = sa; Pwd = 123456; database = News"/>
If it is SQL Server 2000, it is:

<Add key = "connectionstring" value = "Server = (local); uid = sa; Pwd = 123456; database = News"/>


II.SQL Server 2005When an error occurs during connection, pay attention to the following settings:

1Identity Authentication Mode:


2. remote connection:

3,Check whether the related service has been started and set its Port:


0 First, ensure that the server and instance in the connection string are correct:

For example:Connstring ="Data Source = localhost \ sqlexpress; user id = smart; Password = password; packet size = 4096; database = smartschedule-OK";

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.