A network-related or instance-specific error occurred while establishing a connection to SQL Server 2008
-
Monday, May 18, 2009 10:06 PM
I tried this code in visual studio 2008 and i have SQL server 2008 installed on my laptop (my laptop name is MOMO-LAP and my user is MOMO) ,here is the code:
Dim objConnection As SqlConnection = New SqlConnection("server=localhost\MOMO-LAP;database=pubs;user id=MOMO;password=")
Dim objDataAdapter As SqlDataAdapter = New SqlDataAdapter()
Dim objDataset As DataSet = New DataSet()
but when i tried to execute it I receive this 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)
please i need help
All Replies
-
Monday, May 18, 2009 11:15 PM
I believe Server name should be MOMO-LAP or localhost when you have defualt instance.
If it is named instance then it should be SERVERNAME\INSTANCE name.
Mohammedu- Marked As Answer by Xiao-Min Tan – MSFTModerator Monday, June 01, 2009 1:50 AM
-
Wednesday, May 20, 2009 9:21 AMModerator
Hi,
The following blog describes the cause of this error and provides the troubleshooting methods:
http://blogs.msdn.com/sql_protocols/archive/2007/05/13/sql-network-interfaces-error-26-error-locating-server-instance-specified.aspx
If you have any more questions, please let me know.
Thanks.
***Xiao Min Tan***Microsoft Online Community***- Marked As Answer by Xiao-Min Tan – MSFTModerator Monday, June 01, 2009 1:50 AM

