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)
Solution:
1. Open remote connection, enable SA account, set windows verification please view http://hi.baidu.com/atmo/blog/item/ef72dc824adbb7be6d811955.html
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";