Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
I have problem in sql server 2005. when i click on "connect button" it gives the 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)(microsoft sql server).
Posted
Updated 7-Nov-14 4:19am
v2
Comments
Manas Bhardwaj 7-Nov-14 10:24am    
Isn't the error message clear enough?
PIEBALDconsult 7-Nov-14 10:27am    
So? Make sure you specify the name of the server. If it's on a different machine, make sure it's configured properly.
Atta Ur Rahman 118 7-Nov-14 10:31am    
Yes sir! 3 or 4 hour it is correct it don't give the error like this.
PIEBALDconsult 7-Nov-14 10:46am    
Are you saying that it was working for a while and now it isn't?
Atta Ur Rahman 118 7-Nov-14 10:50am    
yes sir!

1 solution

Check your code, and look closely at your connection string.
Ideally, this will be in a config file of some form so it is easy to change without recompiling, but normally it's because you forgot to change it when you moved from a development environment to production - the two normally have very different connection strings.

If you have never connected before, try setting up a connection in VS with the Server Explorer pane:
1) Open Server Explorer.
2) Right click "Data connections" and select "Add connection"
3) In the dialog that follows, select your DataSource, and database, specify the security info, and press the "Test connection" button.
4) When the connection works, press "OK"
5) Highlight your database in the Server Explorer pane, and look at the Properties pane. A working example of the connection string will be shown, which you can copy and paste into your app or config file.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900