provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified

O.A 41 Reputation points
2020-11-15T07:47:59.263+00:00

I get the error message when I try to connect to the SQL Server Database from V/Studio. In the debugger, the compiler fails at the line of code - "connection.Open()";

Here is the connection string as well:

string connectionString = @"Data Source = LAPTOP - C5FEB2D0\SQLEXPRESS; Initial Catalog = TaskManagementApiContext-20180716192646; Integrated Security = True; MultipleActiveResultSets = True;";

I have tried to restart the SQL Server Service. But that has not fixed the issue39911-connectionopen-error.png

Thanks !

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,696 questions
0 comments No comments
{count} votes

Accepted answer
  1. m 4,271 Reputation points
    2020-11-16T07:15:40.237+00:00

    Hi @O.A ,

    Quote from this doc.:

    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. (Try to use a connection string like .\<instance-name> to connect to an instance on your local computer. E.g: .\SQLEXPRESS)
    When you try to connect to an SQL Server instance on another server, 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.

    More information: troubleshoot-connecting-to-the-sql-server-database-engine

    Similar case: sql-network-interfaces-error-26-error-locating-server-instance-specified

    BR,
    Mia


    If the answer is helpful, please click "Accept Answer" and upvote it.

    1 person found this answer helpful.

3 additional answers

Sort by: Most helpful
  1. Thin Thuzar Oo 5 Reputation points
    2023-01-11T08:17:39.25+00:00

    When you connect using Microsoft Management Studio, please type the port no 1433.

    Try Telnet command for 1433 also. In cmd.exe, type this command to check whether port 1433 is on : Telnet IPaddress or PC name 1433 (eg: Telnet 192.168.1.160 1433).

    If cmd shows black screen, the port is opening.

    please turn on Telnet Client in Win10 using Windows features on or off in Control panel.

    Untitled

    1 person found this answer helpful.
    0 comments No comments

  2. Erland Sommarskog 100.9K Reputation points MVP
    2020-11-15T11:12:23.863+00:00

    Is the name of your machine really "LAPTOP - C5FEB2D0" with spaces and all?

    By the way, while it has nothing to do with your connection issue, think twice whether you actually should use Multiple Active Result Sets. This can be a real performance buster when you are working against the cloud.


  3. m 4,271 Reputation points
    2020-11-17T01:42:50.917+00:00

    Hi @O.A ,

    Is the reply helpful?

    BR,
    Mia


    If the answer is helpful, please click "Accept Answer" and upvote it.