I’m writing a simple C# program and want to use an SQL server to store entries from a few users. It works fine locally but I haven’t been able to connect using TCP. I setup remote connections and enabled TCP in the config manager. I keep getting this error.
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)
My connection string is
“Data Source=127.0.0.1\WEBSTORAGE;Network Library=DBMSSOCN;Initial Catalog=Characters;User Id=userid;Password=password;”
You need to change your
Data Sourcein connection string.127.0.0.1is an IP forlocalhost. Replace it with SQL Server machine’s IP address or computer name.Here’s a good overview for connection string syntax: http://connectionstrings.com/sql-server-2008
Edit:
It appears this was a problem with SQL Server Browser service turned off. It’s necessary when you are accessing named SQL Server instances over the network.