"If at first you don't succeed; call it version 1.0" :-Unknown

Pages

Saturday, February 12, 2011

Error: A network-related or instance-specific error occurred while establishing a connection to SQL Server.

 Error: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

If you encounter above error, while running your VS.Net, than first thing you should do is to check your web.config file to make sure that connection string is correct.

This problem might occur if you have recently
a.    Check your PC Name
b.    Installed new sql server instance but have not updated your web.config file with correct instance name.


Example:
Earlier you were using instance name "PCName\SQLExpress" but due to new sql server instance installation your instance name changed to "PCName\NewInstanceName". 

Below is sample connection string, where text in red is cause of problem.
Data Source=PCName\SQLInstance;Initial Catalog=DBName;Integrated Security=True
 

No comments: