ConnectionStrings

Web.config

<connectionStrings>

<add name="DefaultConnection" connectionString="Data Source=.\SQLEXPRESS;Integrated Security=true;Initial Catalog=WinFormsTest" providerName="System.Data.SqlClient"/>

</connectionStrings>

ASP.Net Core

{

  "ConnectionStrings": {

    "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=EFGetStarted.ConsoleApp.NewDb;Trusted_Connection=True;"

  },

}

Snippet

"DefaultConnection": "Server=.\\SQLEXPRESS;Database=IdentityManager;Trusted_Connection=True;TrustServerCertificate=true;MultipleActiveResultSets=true"



==================================================================

WebAPI connection string 

public class ApiDbContext : DbContext

    {

        public DbSet<Category>? Categories { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)

        {

            optionsBuilder.UseSqlServer(@"Data Source =.\SQLEXPRESS; Initial Catalog = RealEstateDb; Integrated Security = true");

       }

    }

======================================================================

DefaultConnection": "Server=.\\SQLEXPRESS;Database=aspnet-pluralsight;User ID=sa;Password=xxxxxxxx;MultipleActiveResultSets=true"

Standard Security

Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;

Connect via an IP address

 "DefaultConnection": "Server=103.174.102.207,1433;Database=BulkyBookCore;User ID=xxxxxxx;Password=xxxxxxxxx;"


Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;

DBMSSOCN=TCP/IP is how to use TCP/IP instead of Named Pipes. At the end of the Data Source is the port to use. 1433 is the default port for SQL Server