There are several reasons for this error. (the step 1 and 2 come from other's article.)
mostly, only it will be ok after step 1 and 3 done.
1. Enable Remote Connection
If you are using SQL Server 2005 Express or SQL Server Developer editions, you have to enable Remote connection on. By default, SQL Server 2005 express, developer and evaluation editions allow local client connections only.
You must enable remote connections for each instance of SQL Server 2005 that you want to connect to from a remote computer. To do this, follow these steps:
i. Click Start->Programs->Microsoft SQL Server 2005->Configuration Tools->SQL Server Surface Area Configuration.
ii. On the SQL Server 2005 Surface Area Configuration page, click Surface Area Configuration for Services and Connections.
iii. On the Surface Area Configuration for Services and Connections page, expand Database Engine, click Remote Connections, click Local and remote connections, click the appropriate protocol to enable for your environment, and then click Apply.
iv. On the Surface Area Configuration for Services and Connections page, expand Database Engine, click Service, click Stop, wait until the MSSQLSERVER service stops, and then click Start to restart the MSSQLSERVER service to effect the above change.
2. Enable SQL Server Browser Service
If you are running SQL Server 2005 by using an instance name and you are not using a specific TCP/IP port number in your connection string, you must enable the SQL Server Browser service to allow for remote connections. For example, SQL Server 2005 Express is installed with a default instance name of Computer Name/SQLEXPRESS. You are only required to enable the SQL Server Browser service one time, regardless of how many instances of SQL Server 2005 you are running. To enable the SQL Server Browser service, follow these steps.
i. Click Start->Programs->Microsoft SQL Server 2005->Configuration Tools->SQL Server Surface Area Configuration.
ii. On the SQL Server 2005 Surface Area Configuration page, click Surface Area Configuration for Services and Connections.
iii. On the Surface Area Configuration for Services and Connections page, click SQL Server Browser, click Automatic for Startup type, and then click Apply.
iv. Click Start, and then click OK.
all these please refer to the picture: https://p-blog.csdn.net/images/p_blog_csdn_net/footpath/EntryImages/20081218/1.GIF
3. Set the sql server properties.
i. Click Start->Programs->Microsoft SQL Server 2005->SQL Server Management Studio
ii. Connect to the server.
iii. Right click the connection, selecct "Properties".
iv. Select "connections" in the "select a page" panel.
v. Check the CheckBox "All remote connections to this server".
vi. Click OK.
please refer to the picure: https://p-blog.csdn.net/images/p_blog_csdn_net/footpath/EntryImages/20081218/2.GIF
After every step is done, please restart the sql server service.