I have a strange error in production environment BUT not in develop environment. In my develop environment, with Visual studio 2010, i can connect without problem to Sql Server 2012. When i copy my Windows Form app to others PC in the same network, i get an "Error 26:Error Locating Server/Instance Specified".
The same application worked good with an old database instance with Sql Server 2008. I don't know what to check and where to start!
EDIT: Another strange behavior is that it works good if i use a code like this
conn.Open()
dr = cmd.ExecuteReader()
But stop to work if i open a form with a datagridview, a dataset and a BindingSource !
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)
this blog post has detailed information about error 26.
From the post:
In a word, the reason that we get this error message is the client stack could not receive SSRP response UDP packet from SQL Browser. It's easy to isolate the issue. Here are the steps:
- Make sure your server name is correct, e.g., no typo on the name.
- Make sure your instance name is correct and there is actually such an instance on your target machine. [Update: Some application converts \ to . If you are not sure about your application, please try both Server\Instance and Server\\Instance in your connection string]
- Make sure the server machine is reachable, e.g, DNS can be resolve correctly, you are able to ping the server (not always true).
- Make sure SQL Browser service is running on the server.
- If firewall is enabled on the server, you need to put sqlbrowser.exe and/or UDP port 1434 into exception.
Once you are done the steps, you should not see this error message anymore. You may still fail to connect your SQL server, but error message should be different and you have a different issue now. [Update: If it still fails, you may replace server\instance with tcp:server\instance and/or np:server\instance and see if it succeeds with either TCP or NP protocol. That way, you can isolate the issue a little bit. ]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With