1 using System.Data; 2 using System.Data.SqlClient;
1 //A single instance exists in the Windows Authentication Mode database2 stringConnectionString ="Data source=localhost;initial catalog=northwind;integrated security=sspi;"3 //multiple instances exist in Windows Authentication Mode database4 stringConnectionString ="Data source=localhost\sqlexpress;initial catalog=northwind;integrated security=true;"5 //SQL Server authentication method ==data source=127.0.0.1 can link a local database6 stringConnectionString ="Data source=10.1.2.3;initial Catalog=northwind; User Id=sa; Password=abc123";
Among them "Integrated Security=sspi;" && "Integrated security=true;" Setting integrated security to SSPI or true is equivalent even if authenticated with the current Windows account credentials. However, in an ASP. NET program may be different from the current running hosting environment, the user point will vary
① use the ASP. NET account in Windows XP; ② use the Network Service account in Windows 2003 and later;③ is in visual Studio using the user account in the current development environment, not the ASP.
Asp. NET connection SQL Server connection string