provider: SQL Network Interfaces, error: 26

Zhang, Yilang 21 Reputation points

I try to build the Database App in this Microsoft Walkthrough:(Simple Object Model and Query (C#)

In fact when I debug it it said: System.Data.SqlClient.SqlException: '在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接。 (provider: SQL Network Interfaces, error: 26 - 定位指定的服务器/实例时出错)' like this: 93100-image.png

I try to add database on VS2019 and see the Troubleshooting section of Learning by Walkthroughs . but it still not works. I opened SQL Server(MSSQLSERVER), and also open TCP/IP and Names Pipes. I also make a rules to allow use 1433 on firewall.

I have no idea to solve this problem, any suggestions? Or I need to connectionString on App.config? Even if in LINQ to SQL? Is so here is my connectionString

and how to add it?

And I felt. Mircosoft docs missing some steps....

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,558 questions
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,592 questions
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,165 questions
Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
932 questions
0 comments No comments
{count} votes

Accepted answer
  1. Karen Payne MVP 35,026 Reputation points

    Your connection string should be as follows if using SQL-Server Express edition

    Server=.\SQLEXPRESS;Database=NorthWind;Integrated Security=true

    The connection string may be stored in app.config or if using .NET 5 in appsettings.json

    "database": {
    "DatabaseServer": ".\\SQLEXPRESS",
    "Catalog": "NorthWind2020",
    "IntegratedSecurity": "true",
    "UsingLogging": "true"
    "ConnectionStrings": {
    "DevelopmentConnection": "Server=.\\SQLEXPRESS;Database=NorthWind2020;Integrated Security=true",
    "ProductionConnection": "Server=.\\SQLEXPRESS;Database=NorthWind2020;Integrated Security=true"
    "Environment": {
    "Production": false

    Now with that understood see my code samples, one uses Entity Framework Core (preferred) while the other uses a data provider. Both use the same connection string under ConnectionStrings -> DevelopmentConnection were Environment specifies prod or dev (yes both are the same but in a real app they would be different.

    The database for the code sample is a modified version of the original NorthWind which I created in 2020 hence 2020 appended to the catalog name.

    Here is the database script.

1 additional answer

Sort by: Most helpful
  1. Thin Thuzar Oo 5 Reputation points

    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 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.

    0 comments No comments