Search code examples
vb.netvisual-studio-2017sqlclient

I am getting an error 26 connection issue to SQL server


I created a datasource using the wizard, previewed the data, and everything looks good, all of the data is showing up. I attempt to use the fill method on the built in datagrid control, and it times out telling me

message=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)

Source=.Net SqlClient Data Provider

How can i preview the data, but then all of the sudden when the application actually starts, i cant access the server at all?

Data Preview at work


Solution

  • I was compiling and running my project from a mapped network drive, and i tried EVERYTHING i had permissions to try to fix this, including checking all of our production SQL server's settings. i tried every connection client, including linking the table in an access database and trying to connect to the table that way, and nothing. Every other application from access to excel to SSMS to visual studio itself could connect, just not my built application. Then i tried moving my project to my physical drive on a whim and all of the sudden, it had no connection issues.